Laravel-excel: Problem importing big xlsx

Created on 4 Jun 2016  路  8Comments  路  Source: Maatwebsite/Laravel-Excel

Hi,
i've some difficult to try import a xlsx. This file size 9MB;
I've tried
Excel::filter('chunk')->selectSheetsByIndex(0)->load('new.xlsx')->chunk(1, function($results) { echo 'OK'; exit; });
but it throw PHP Fatal error: Allowed memory size

how to let run right? thank you

All 8 comments

Try putting your memory limit higher.

Hello,

I'm having a similar issue. Getting a 504 Gateway Time-out (local homestead) when importing a 1.4 MB .xlsx file with a simple echo for each row in the result set.

Excel::filter('chunk')->load('data.xlsx')->chunk(50, function($results) { foreach($results as $row) { echo $row['id']; } });

I've tried increasing memory limit as suggested as well as increasing max_execution_time (php.ini), request_terminate_timeout (pool.d/www.conf), and fastcgi_read_timeout (nginx config), but to no avail.

Not sure where to go from here. Any suggestions?

Thanks!

You could run it as a job in a queue, so it won't eat through your memory and is handled async to your requests. Write the results to a table in your DB and echo the table in a view.

@nikeshbhagat have you found any solution to your problem?

@MacDino @nikeshbhagat @hcancelik Try importing it as a .csv file. I was able to load a file in .csv that otherwise wasn't working in .xls.

Did you find a solution for this case?

@Silwady What's your solution ? You can share it.

@bigz3ro I didn't find the solution yet

Was this page helpful?
0 / 5 - 0 ratings