There are few issues I faced with XLS Data export and batch.
1. Empty file pre-created on first step of batch and then could not be read: "Unable to identify a reader for this file", because file doesn't contain xls headers.
Proposed solution: for xls(x) create empty spreadsheet object and save it into file instead of empty string.
2. If point 1 is solved, there are another issue that data of first batch operation is not stored into initialized file, so we loose header and first N rows (N - batch limit you configured).
Propesed solution: Remove condition by batch progress to write data into previous file, because before it wasn't written anywhere.
Issue fork views_data_export-3277334
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3277334-xls-batch-fix
changes, plain diff MR !73
- 3277334-xls-batch-doesnt
changes, plain diff MR !10
Comments
Comment #3
kiseleva.t commentedComment #4
kiseleva.t commentedPatch #4 for release 8.x-1.1
Comment #5
punamshelkeAdded Patch #4 for release 8.x-1.3
Comment #7
punamshelkeComment #8
realityloop commentedTried #7 and still getting error
Drupal 10.2.2
Comment #9
jawidosI just had the same problem and after searching some more i found the problem.
As mentioned here (https://github.com/PHPOffice/PhpSpreadsheet/issues/3930) PhpSpreadsheet function setCellValueByColumnAndRow was deprecated and is removed in 2.0
So i just replaced that funtion with the new one and it works again.
I il add the patch for anyone who needs it.
Comment #10
chetananemade commentedHi,
The patch in #7 worked well for us with Drupal 10.2 and Views_data_export 1.4.
However, after upgrading to Drupal 10.3 and Views_data_export 1.5, we have updated the patch in #7 to make it compatible with the new versions.
The patch in #9 is already included in Views_data_export 1.5.
Comment #11
steven jones commented@chetananemade thanks for the updated patch. We should try to get this into a MR instead of using patches.
Comment #14
jhedstromComment #15
steven jones commented@jhedstrom thanks for the MR I feel like this is the sort of thing that really should have a test. We have a test for CSV exports, but not for XLS ones, but we do include the module for testing etc. We should probably have a test for this sort of thing so that we don't introduce regressions etc.
I think we could either add another test case to the existing class, or have a new class for testing XLS stuff specifically, don't mind.
Comment #16
realityloop commentedRe-rolled for 1.8