-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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] Uploading big excel file #1394
Comments
Greetings Silwady, |
sorry, just saw the error message in ur screenshoot, try increase the memory limit to either 512MB or even 1GB . laravel is known to consume good amount of memory. |
I tried to use chunk filter, but it returned
What I need now is returning |
pass $data = [];
Excel::filter('chunk')->load($path)->chunk(1000, function ($results) use (&$data) {
foreach ($results as $row) {
$data[] = $row;
}
}, $shouldQueue = false);
return $data; see Import > Queued Chunks in docs for details |
it works :) it reads a first 1000 row, but unfortunately it is stopped directly after that, so it reads only 1000 row, What do you suggest for that? EDIT: The file analysis is called within custom queue (I created it), If I used |
ok, so using a local variable to store the file content won't work in that case. Maybe store a collection in the container like so: // Setup a collection in the container
app()->instance('analysisResults', collect());
// Read the workbook in chunks
Excel::filter('chunk')->load($path)->chunk(1000, function ($rows) {
// Merge the current chunk of rows into the collection
app()->instance('analysisResults', app('analysisResults')->merge($rows));
});
// Dump all the rows
dd(app('analysisResults')); |
@stephanecoinon I suspect that it has to with having cell data, this worked for me: $data = [];
Excel::filter('chunk')->load($path)->chunk(1000, function ($results) use (&$data) {
foreach ($results as $row) {
$data[] = $row->toArray();
}
}, $shouldQueue = false);
return $data; Also found a sweetspot of 400 instead of 1000, but ymmv. |
Hello, guys |
I am facing the same issue I have 30 records file size is 20 MB, using chunk as well |
Package version, Laravel version
Laravel 5.5
Maatwebsite/Laravel-Excel 2.1
Expected behaviour
The project works fine on small files (less than 1.5MB). It Must upload big files like 20MB - 30MB.
Actual behaviour
It shows this error message when uploading excel files bigger than 1.5MB. My sheet is about 22 column and at least 10K rows
Error as shown in Whoops
php info file
I used this code (which is works with small files)
What should I do?
The text was updated successfully, but these errors were encountered: