Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using a column (by referencing its header name) which is positioned directly before another column with an empty header cell, row data from the latter column is returned instead of from the former.
This is due to $value
not being reset in getHeaders().
Please see attached patch for a fix.
Comment | File | Size | Author |
---|---|---|---|
#7 | 2914156-7-test-only.patch | 3.19 KB | claudiu.cristea |
#7 | 2914156-7.patch | 3.87 KB | claudiu.cristea |
#4 | migrate_spreadsheet-missing_column_test-2914156-8.x.patch | 3.67 KB | woutgg |
migrate_spreadsheet.patch | 743 bytes | woutgg |
Comments
Comment #2
claudiu.cristeaI don't get your case. Let's add a test case in `\Drupal\Tests\migrate_spreadsheet\Unit\SpreadsheetIteratorTest` that proves the bug.
Comment #3
claudiu.cristeaComment #4
woutgg CreditAttribution: woutgg commentedThe attached patch extends the unit tests to cover this issue.
It adds a column G (leaving F undefined) and extends the rows. The tests have only been changed to reflect these worksheet additions.
The non-existing column reflects how phpspreadsheet behaves, at least when given a CSV file with an empty header column, e.g.:
a,b,c,d,e,,g
.
Comment #5
claudiu.cristeaComment #7
claudiu.cristeaRerolled, reworked a little bit the test.
Comment #8
claudiu.cristeaComment #11
claudiu.cristeaThank you for reporting & patch. Fixed.