Home » excel » How to Increase amount of data an Excel cell can hold using PHP

How to Increase amount of data an Excel cell can hold using PHP

Posted by: admin May 14, 2020 Leave a comment


I have a requirement on exporting Database records to excel file in my application.
For this purpose i am using a light weight class from a blog External Link to Blog

It works fine.. But I am facing a problem.. If String length is more than Say 200, then it is not inserting data to the cell. I want to increase amount of data a cell can hold.. Does anybody have any idea, how it can be done normally using PHP

Thanks for help in advance

How to&Answers:

Excel has limits on the amount of data a cell can hold: for Excel BIFF 8 files, that limit is 32,767 characters, so (in theory) 200+ characters should not be an issue.
However, for longer strings, this data is maintained in the BIFF file across several blocks with continuation records, For BIFF 5 files (Excel 95) the limit is 2084 bytes per block; in BIFF 8 files (Excel 97 and above) the limit is 8228 bytes. Records that are longer than these limits must be split up into CONTINUE blocks.

This relatively simplistic writer isn’t written to handle splitting the record into multiple continuation records: it doesn’t even use the BIFF 8 shared string table, or indicate what BIFF version it is writing (which means Excel will open it using lowest common denominator parameters). It simply tries to store the entire contents of the cell into a standard label block (which has a limit of 255 bytes). To fix this, you’d need to fix the library that you’re using to handle splitting the string values with continuation blocks (via a shared string table); or switch to a library that does handle splitting the shared strings across multiple blocks already.