php - PHPExcel: using "getHighestRow" in combination with read filter -
I am currently using PHPExcel to read an Excel file using the reading filter, because the ability to create spreadsheets It's bigger in the future, and I need to make sure that despite the ample memory size it remains free to handle it.
As part of the argument, I want to get the number of rows in the sheet, which I can be exposed to as the following:
$ file = 'path / to / spreadsheet.xslx'; $ ObjReader = PHPExcel_IOFactory :: createReader ('Excel2007'); $ ObjPHPExcel = $ objReader-> Load ($ file); Return $ objPHPExcel-> GetActiveSheet () - & gt; GetHighestRow (); My question is, is this the reason for running PHP when this file is archived? So in the same way if I use the following with a large file:
$ objPHPExcel-> getActiveSheet ( ) - & gt; TooArray (); And if so, is there a way to get the highest line without causing a memory problem when the file gets bigger?
I tested it as far as there is a 3 MB file on my local machine, and it seems to be handled properly, takes the highest line to return, and for a longer file is.
You can retrieve the number of rows (or columns) in the worksheet without loading the entire file :
$ file = 'path / to /spreadsheet.xslx'; $ ObjReader = PHPExcel_IOFactory :: createReader ('Excel2007'); $ Worksheetdata = $ objReader-> List worksheetinfo ($ file); Echo & lt; H3 & gt; Worksheet Notifications & lt; / H3 & gt; '; Echo '& lt; Ol & gt; '; Forex Currency ($ worksheet data as $ worksheet) {echo '& lt; Li & gt; ', $ worksheet [' worksheet '],' & lt; Br / & gt; '; 'Rows:', $ worksheets ['Total RAO'], 'Columns', $ worksheets [' Total Columns'], '& lt; Br / & gt; Echo 'cell range: A1:', $ worksheet ['last column liter'], $ worksheet ['total row']; Echo & lt; / Li & gt; '; } Echo '& lt; / Ol> '; PHPExcel User Documentation - Reading spreadsheet files Sections 7 ( Supporting methods ) is shown in>
Comments
Post a Comment