I'm using this lib to parse xls/xlsx files into csv files.
I've got xlsx file with 3 sheets and ~90k rows on each sheet.
I'm reading this file using such a piece of code:
But I've tried to find a way to decrease execution time.
After resaving this xlsx file into just xls format (using libreoffice calc) I've noticed that reading is much faster (execution takes only 3 seconds for whole file). But there was one sad thing: in xls files only ~65k rows can be stored.
So I went further and realised, that I can convert xlsx files into xls files using this lib (even if I'll lose some rows) and then read all rows, that where cut, from original file (it would be much faster: 3 seconds of reading xls file + ~ 200 seconds for reading ~30k rows from tile of xlsx file).
But if you'll try to use this code:
$workbook = new \ExcelBook($libxl_name, $libxl_code, 'xlsx' == $extension);
$res = $workbook->loadFile($from);
if ('xlsx' == $extension) {
$workbook->save('some_file.xls');
unset($workbook);
$workbook = new \ExcelBook($libxl_name, $libxl_code, false);
$res = $workbook->loadFile('some_file.xls);
}
then $res variable will be false. And if you'll try to open some_file.xls using program (e.g. libreoffice calc) it won't be opened 'cause it's broken for reading.
Probably, I'm using wrong way to manipulate files, but I was thinking it should work.
Hello everyone!
I'm using this lib to parse xls/xlsx files into csv files. I've got xlsx file with 3 sheets and ~90k rows on each sheet. I'm reading this file using such a piece of code:
Unfortunately, only the first page takes over 30 minutes of just reading (not a word about processing). Experiment shows such results:
But I've tried to find a way to decrease execution time. After resaving this xlsx file into just xls format (using libreoffice calc) I've noticed that reading is much faster (execution takes only 3 seconds for whole file). But there was one sad thing: in xls files only ~65k rows can be stored. So I went further and realised, that I can convert xlsx files into xls files using this lib (even if I'll lose some rows) and then read all rows, that where cut, from original file (it would be much faster: 3 seconds of reading xls file + ~ 200 seconds for reading ~30k rows from tile of xlsx file). But if you'll try to use this code:
then
$res
variable will befalse
. And if you'll try to open some_file.xls using program (e.g. libreoffice calc) it won't be opened 'cause it's broken for reading.Probably, I'm using wrong way to manipulate files, but I was thinking it should work.