You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an Excel file which I'm using as a template, the process is:
Read the file using Xlsx::load()
Fill specific cells with some data
Write the file using Xlsx::save()
This specific excel file that takes 30-60 just for the first step, but I'm unable to track down why.
I've used Calculation::setWriteDebugLog(true) to debug issues with incorrect formulas before, but I cannot find any way to debug reading or writing an excel file.
Using the following script, I've managed to verify that it's the load() step that is taking the most amount of time, the save() step only takes a couple of seconds, and the rest is almost instant.
This made some improvement but it's still very slow. The following things managed to get the loading down to under a second, but result in an unusable output file:
Xlsx::setReadDataOnly(true)
the resulting output file is completely unformatted
Xlsx::setReadFilter($filter)
where the $filter limits to the specific cells that I need to write to
the resulting output file only has data is these specific cells then
Xlsx::setLoadSheetsOnly(...)
where it limits only to the one sheet I have to write to
the resulting output file is missing all the other sheets
Clearing all formatting in the template excel file
Deleting other sheets in the template excel file
From what I can tell, it's just a combination of the size of the file and the formatting in the file since it only makes a difference if I remove a lot of the sheets or all of the formatting.
Unfortunately I cannot share the template excel file, but I was wondering if someone has had similar issues before?
Maybe there was a process to debug this type of thing? Is there was some specific formulas or formatting known to cause these issues or a way to narrow down exactly what is slow?
Or potentially there's another way to accomplish my goal without having to read the entire file and all the formatting into memory? I don't care about the rest of the data or formatting in the excel file for this process, but I need the resulting output file to have the existing data and formatting.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an Excel file which I'm using as a template, the process is:
Xlsx::load()
Xlsx::save()
This specific excel file that takes 30-60 just for the first step, but I'm unable to track down why.
I've used
Calculation::setWriteDebugLog(true)
to debug issues with incorrect formulas before, but I cannot find any way to debug reading or writing an excel file.Using the following script, I've managed to verify that it's the
load()
step that is taking the most amount of time, thesave()
step only takes a couple of seconds, and the rest is almost instant.I've tried quite a few different things to solve the issue without rendering the resulting excel file unusable.
This made some improvement but it's still very slow. The following things managed to get the loading down to under a second, but result in an unusable output file:
Xlsx::setReadDataOnly(true)
Xlsx::setReadFilter($filter)
$filter
limits to the specific cells that I need to write toXlsx::setLoadSheetsOnly(...)
From what I can tell, it's just a combination of the size of the file and the formatting in the file since it only makes a difference if I remove a lot of the sheets or all of the formatting.
Unfortunately I cannot share the template excel file, but I was wondering if someone has had similar issues before?
Maybe there was a process to debug this type of thing? Is there was some specific formulas or formatting known to cause these issues or a way to narrow down exactly what is slow?
Or potentially there's another way to accomplish my goal without having to read the entire file and all the formatting into memory? I don't care about the rest of the data or formatting in the excel file for this process, but I need the resulting output file to have the existing data and formatting.
Beta Was this translation helpful? Give feedback.
All reactions