I used phpExcelReader to import a large amount of data. I found an example on the internet. I can use phpexcel to import an excel file to a database. However, once there are more than 122 pieces of data, for example, if an excel file contains 123 pieces of data, it cannot be imported. I will post out the code. let's see: require_once & nbsp;... phpExcelReaderExcelreader. php; $ data & nbsp; phpExcelReader cannot import a large amount of data.
I have found an example on the internet. I can use phpexcel to import an excel file to a database, but once there are more than 122 pieces of data, for example, one excel file contains 123 pieces of data and cannot be imported. I will post the code. let's take a look:
Require_once '../phpExcelReader/Excel/reader. php ';
$ Data = new Spreadsheet_Excel_Reader ();
$ Data-> setOutputEncoding ('gb2312 ');
$ Data-> read ('../lfx.xls ');
}
For ($ I = 1; $ I <= $ data-> sheets [0] ['numrows ']; $ I ++)
{
For ($ j = 1; $ j <= $ data-> sheets [0] ['numcols']; $ j ++)
{
Echo $ data-> sheets [0] ['cells '] [$ I] [$ j];
}
}
When the above code is smaller than 123 excel files, all records can be printed on the web page, but if the number is greater than or equal to 123, it is blank, and I need to import more than 5000 pieces of data, in distress.
Attached phpExcelReader and my excel
Thank you!
------ Solution ----------------------
/*
* PHPExcel. V1.7.6 [read example]
*/
Include 'phpexcel/IOFactory. php ';
$ Filename = "d:/test.xls ";
$ ReadType = PHPExcel_IOFactory: identify ($ filename); // get it if you do not know the document type
$ ExcelReader = PHPExcel_IOFactory: createReader ($ readType );
$ PHPExcelObj = $ excelReader-> load ($ filename );
$ CurrentSheet = $ PHPExcelObj-> getSheet (0); // select the first form (Sheet1) as the current operation form.
$ ExcelRows = $ currentSheet-> getHighestRow (); // get the largest row
$ ExcelColumn = $ currentSheet-> getHighestColumn (); // get the maximum column
Foreach (range (1, $ excelRows) as $ row ){
$ Line ='';
Foreach (range ('A', $ excelColumn) as $ column ){
$ Line. = $ currentSheet-> getCell ($ column. $ row)-> getValue ().",";
}
$ Line. ='
';
Echo $ line;
}
------ Solution ----------------------
Reference:
I have found an example on the internet. I can use phpexcel to import an excel file to a database, but once there are more than 122 pieces of data, for example, one excel file contains 123 pieces of data and cannot be imported. I will post the code. let's take a look:
Require_once '../phpExcelReader/Excel/reader. php ';
$ Data = new Spreadsheet_Excel_Reader ();
$ Data-> setOutput ......
Use this: http://www.phpclasses.org/package/6235-PHP-Parse-and-access-binary-Excel-files-in-pure-PHP.html
After using it, I think it is very good. it supports Chinese characters and xlsx format. it can traverse and parse all tables, columns, rows, and cells. PhpExcelReader was also used before, and found many problems, so I found this.