1. 程式人生 > >使用spreadsheet-reader流式讀取超大excel文件

使用spreadsheet-reader流式讀取超大excel文件

array ring input 生成 wps fine ads emp 報錯

github:https://github.com/nuovo/spreadsheet-reader

最近有一個讀取超大excel文件的功能需求,使用的phpexcel,有嚴重的內存泄露問題,暫時還未找到解決方案。

spreadsheet-reader是流式讀取excel的,對於大多數格式的excel都能正常的讀取,且內存消耗很小。

PS:其中遇到的坑

xlsx文件一定要標準,也就是必須是offce生成的,而不是wps之類的……被這個坑了很久

如果不正確會出現如下報錯,個人猜測是文件頭問題,建議用office打開另存為一份就沒問題了

Warning: XMLReader::open(): Empty string supplied as input in C:\myphp_www\PHPTutorial\WWW\spreadsheet-reader-master\SpreadsheetReader_XLSX.php

on line 959

Warning: XMLReader::read(): Load Data before trying to read in C:\myphp_www\PHPTutorial\WWW\spreadsheet-reader-master\SpreadsheetReader_XLSX.php on line 995

Notice: Undefined variable: i in C:\myphp_www\PHPTutorial\WWW\test.php on line 10
Array ( )
Warning: XMLReader::read(): Load Data before trying to read in C:\myphp_www\PHPTutorial\WWW\spreadsheet-reader-master\SpreadsheetReader_XLSX.php
on line 995

使用spreadsheet-reader流式讀取超大excel文件