It could be memory limit problem or it could be problem with excel data.
The data you are trying to enter should not exceed the memory limit or the max number of rows for the excel application.
The max number is 65536 rows.
And for memory limit problems, try this
write the below code at the top of your php file.