Comments (11)
try this hack
if ( $xlsx = SimpleXLSX::parse('book.xlsx') ) {
$sheet_names = $xlsx->sheetNames();
reset( $sheet_names);
$first_sheet_id = key( $sheet_names );
print_r( $xlsx->rows( $first_sheet_id ) );
} else {
echo SimpleXLSX::parse_error();
}
from simplexlsx.
from simplexlsx.
I can confirm the issue. Most recent simplexlsx version is still having troubles to open some xlsx file created by LibreOffice (LibreOffice V5.3.1.2 on Kubuntu 16.04).
upload_template.xlsx
from simplexlsx.
Hello! Excelente work!!
In my case the sheet id was number 3, I found that when print_r the sheet names, the only one was [3]=>Hoja1.
So, I add after the solution Pedro (but in another function) post a second check for id 3. I worked for me to solve quickly.
public function worksheet( $worksheet_id ) {
if(!isset($this->sheets[1]) && isset($this->sheets[2])){
$this->sheets[1] = $this->sheets[2];
$worksheet_id = 2;
}else if(!isset($this->sheets[2]) && isset($this->sheets[3])){
$this->sheets[1] = $this->sheets[3];
$worksheet_id = 3;
}
if ( isset( $this->sheets[ $worksheet_id ] ) ) {
$ws = $this->sheets[ $worksheet_id ];
if (isset($ws->hyperlinks)) {
$this->hyperlinks = array();
foreach( $ws->hyperlinks->hyperlink as $hyperlink ) {
$this->hyperlinks[ (string) $hyperlink['ref'] ] = (string) $hyperlink['display'];
}
}
return $ws;
} else {
$this->error( 'Worksheet '.$worksheet_id.' not found.');
return false;
}
}
Thanks!
from simplexlsx.
Hi @shuchkin why is this closed? after saving xlsx in libre, the script won't work for me.
if ( $xlsx = SimpleXLSX::parse($tmp_file) ) {
print_r( $xlsx->rows() );
} else {
echo SimpleXLSX::parse_error();
}
does not throw a message. just a blank page :(
Thanks for the work you have done! saved in excel it worked just perfect :)
from simplexlsx.
ini_set('display_errors', true);
ini_set('error_reporting', E_ALL);
if ( $xlsx = SimpleXLSX::parse($tmp_file) ) {
print_r( $xlsx->rows() );
} else {
echo SimpleXLSX::parse_error();
}
from simplexlsx.
thanks for your fast response, it didn't show any errors either, sorry. Were you able to read the upload_template.xlsx
Kukulkano uploaded? I am not.
from simplexlsx.
great, thank you, this worked! 💯 I don't really understand what these lines do, are you able to patch this? or can you provide me any if statement that tells me if the file is a Libre file?
from simplexlsx.
I'm also interested in a generic solution. It should be able to handle both Microsoft Excel and LibreOffice Calc saved xlsx files out of the box. If parsing the sheets solves the issue, maybe it can be done in general?
from simplexlsx.
@Kukulkano It's fixed in the latest version 👍
from simplexlsx.
Oh, 9 days ago. Great! Thanks! :)
from simplexlsx.
Related Issues (20)
- Pivot Table
- Undefined index: alignment HOT 2
- date parse error HOT 2
- Unknown archive format HOT 2
- File with LF instead of CRLF won't parse HOT 7
- Read Rows by Limit, offset HOT 1
- readRowsEx limit arg HOT 1
- Don't parse all numbers using `if ( is_numeric( ... ) )` HOT 4
- Can't use Composer to install
- Html tags deleted when writing in Cell HOT 1
- Need help getting each cell value for every row HOT 1
- Increasing memory usage HOT 3
- If the string in a cell contains a half-width English comma, it will be split into two cells. HOT 2
- The 'activeSheet' value is not set HOT 1
- issues with php 8 HOT 1
- Hyperlinks HOT 3
- Error with future date HOT 1
- Deprecated : preg_replace(): Passing null to parameter #3 SimpleXLSX.php on line 927 HOT 3
- parse hyperlinks HOT 1
- Strange error with PHP 8.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simplexlsx.