PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 5, 2022

[FIXED] how to load just a few rows of .xls file with phpexcel?

 October 05, 2022     converter, csv, php, phpexcel     No comments   

Issue

I have a trouble with converting a .xls file (Excel) to CSV in PHPExcel.

All works fine until comes some Big file. My php script just exceeds the memory limit and blows up. I cannot use more than 64MB because of the specifics of the computer. I'm running Apache on it. We need to find a solution.

I think I have to tell PHPExcel to load just a few lines of Excel than convert it to small CSV, save it, free the used memory and so on with the rest of the file until it's done...

What you think about? Can we find the more accurate way of doing it.


Solution

You have a few options for saving memory with PHPExcel. The main two are:

  • cell caching, described in section 4.2.1 of the developer documentation,

    This allows you to reduce the memory overhead for each cell that is read from the file

  • Chunking, described in section 4.3 of the User Documentation for Readers

    This allows you to read small ranges of rows and columns from a file, rather than the whole worksheet



Answered By - Mark Baker
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing