Skip to content
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

[Bug]: When exporting csv of more than 1001 rows, if NO header rows are used, the output file is only 1000 rows #4098

Closed
1 task done
realtebo opened this issue Mar 5, 2024 · 3 comments

Comments

@realtebo
Copy link

realtebo commented Mar 5, 2024

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

  • Yes, it's still reproducable

What version of Laravel Excel are you using?

3.1.55

What version of Laravel are you using?

10.46.0

What version of PHP are you using?

8.1.3

Describe your issue

I hopw this issue will find you well.

I am exporting a huge amount of data, more than 10.000 rows

If we DO NOT use the concern "WIthHeadings", the output file is only 1.000 rows.

We think the problem is thiscode block: https://github.com/SpartnerNL/Laravel-Excel/blob/3.1/src/Sheet.php#L658-L676

Because when the code estabilish if the first line is not empty, actually is returning always false. So the export restart overwriting, at each 1000 rows of chunk, as per your code, from first line.

This behaviour doesn't happens if using an heading row.

But we absolutely need to do not have heading rows in our file.

How can the issue be reproduced?

Try to export a csv with a few of thousands of rows without WithHeadings Concerns

What should be the expected behaviour?

Every rows should be saved into file, not last 1.000

@realtebo realtebo added the bug label Mar 5, 2024
@realtebo
Copy link
Author

realtebo commented Mar 6, 2024

After digging into the rabbit hole for half a day, one genius, a coworker, found the trigger, the root cause of the bug

All starts because we have to export a strange csv file where _the first column of the first line is an empty cell. AND we have no headings in the csv

When your (excellent and unreplaceable) code try to understand if there are data already exported, read the 'a1' cell and checks if it's populated. So it's a false negative, in this case, and the code thinks there are no already exported data, and so, restart from 'a1' and override in the Sheet class the whole already exported data.

@realtebo
Copy link
Author

realtebo commented Mar 6, 2024

Here again to add another detail.

We had success adding WithStrictNullComparision concern.

Using this workaround, the performance are a bit worse than without using it, but we can succesfully export all rows, without using headers, in a situation when a1 cell is always empty

@stale stale bot added the stale label May 5, 2024
Copy link

stale bot commented May 8, 2024

This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions.

@stale stale bot closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant