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
- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
When removing a column from the worksheet, all remaining column and row values should stay in place, including empty and null values.
What is the current behavior?
When removing a column before the last column, if the next column's value is empty or null instead of keeping that column's value it shifts the removed column's value into that column.
With CSV reader when loading file with loadIntoExisting() method, following line checks if "cell" value is empty, and prevents inserting if it is empty
I'll be happy to create a PR with the solution if you agree with it.
The other possible solution would be modifying how \PhpOffice\PhpSpreadsheet\ReferenceHelper@insertNewBefore() method works and making it not rely on $worksheet->getCoordinates() to remove and replace columns. But I think it would make sense to be able to control if a cell needs to be created when $rowDatum is empty.
The text was updated successfully, but these errors were encountered:
This is:
What is the expected behavior?
When removing a column from the worksheet, all remaining column and row values should stay in place, including empty and
null
values.What is the current behavior?
When removing a column before the last column, if the next column's value is empty or null instead of keeping that column's value it shifts the removed column's value into that column.
What are the steps to reproduce?
Take following data as example:
The result ends like this:
But it must be like this:
Which versions of PhpSpreadsheet and PHP are affected?
phpoffice/[email protected]
Cause
With CSV reader when loading file with
loadIntoExisting()
method, following line checks if "cell" value is empty, and prevents inserting if it is emptyPhpSpreadsheet/src/PhpSpreadsheet/Reader/Csv.php
Line 325 in e7b0497
Possible solution
We can make a property and setter like:
And change that
if
statement to:I'll be happy to create a PR with the solution if you agree with it.
The other possible solution would be modifying how
\PhpOffice\PhpSpreadsheet\ReferenceHelper@insertNewBefore()
method works and making it not rely on$worksheet->getCoordinates()
to remove and replace columns. But I think it would make sense to be able to control if a cell needs to be created when$rowDatum
is empty.The text was updated successfully, but these errors were encountered: