-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow differing column counts per row in CSV export #1414
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
oleibman
added a commit
to oleibman/PhpSpreadsheet
that referenced
this issue
Jun 27, 2024
Supersedes PR PHPOffice#1415 by @AndrewMonty, which went stale in May 2020, and which is not directly usable due to changes between now and then. Fix PHPOffice#1414, which also went stale; I will remove the stale status and reopen the issue pending the merging of this PR. Add an option to CSV Writer so that it writes the cells for a row only through the highest data column used in the row, rather than through the highest data column used in the worksheet.
10 tasks
Will be fixed by 4076. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is:
What is the expected behavior?
There should be an option for each row in a CSV file to have a different number of columns.
Consider a spreadsheet where the first few rows are not actually column headers, but rather some custom heading (in my case a requirement of some third party system consuming the CSV file).
Represented as an array, this might look like:
And as a spreadsheet:
Writing to a CSV should have the option to exclude the blank cells on each row:
What is the current behavior?
Currently, the spreadsheet described above would save as a csv like:
Where the row with the most columns dictates the column count for all rows, and any that fall short are filled with blanks.
What are the steps to reproduce?
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet 1.10.1
PHP 7.3
The text was updated successfully, but these errors were encountered: