PHP library for read data of spreadsheet files. It supports OpenDocument Spreadsheet (.ods), Microsoft Excel 97/2000 (.xls), CSV (.csv), and Text with tab-separated or patterns (.txt).
Use this command to anonymously check out the latest project source code:
This proejct is hosted in php-spreadsheetreader - Google Code. It is issued on under the GNU Lesser General Public License. For further information click here.
Todo
Plan to rewrite Excel reader with pure PHP code.
There is a PHP Excel Reader written by pure PHP code.
(http://sourceforge.net/projects/phpexcelreader/) I would rewrite my Excel reader by that one. Instead of invoking the
external reader, jxl.
Latest Change
Revision 24:
Add method: asXml(). This return $sheets as Xml string (Excel XML format). Therefor you can save it or put into a download stream. 可以將 $sheets 轉為 XML 字串 (Excel 2000/XP 的XML格式)。這可讓你將試算表保存為一個 XML 檔案,或加到一個檔案下載的串流中。
Revision 21:
It can return sheets as associative array. 可以將試算表結果回傳為關聯式陣列。將第一列視為欄位標頭,作為陣列的鍵值。
Revision 16:
Support MS Excel 2000/XP's XML file. Note: Excel 2000/XP's XML file format is a single XML file, and different from Office OpenXML. 支援 MS Excel 2000/XP 的 XML 格式試算表。注意: MS Excel 2000/XP 的 XML 格式試算表是一種單一XML文件,與 Office OpenXML 不同。同樣是純文字文字格式,但 Excel 2000/XP XML 較 CSV 對資料型態及中日韓文的支持更好。
Bug fixed
Let factory detect file-type case-insensitive.
Bug of SpreadsheetReader_Excel: Sometimes, data will contain non-readable chars (I put in $ignoreChar). XML parser will occur a parse error. So we need to strip those non-readable chars.
It only output tables which have text in their first cell. Now fix it.
When read with READ_ASSOC, it forgets to skip the first Row(fields header) after 2nd sheet.
php-SpreadsheetReader - A PHP library for read spreadsheet files
Copyright (C) 2006 Shih Yuncheng
http://code.google.com/p/php-spreadsheetreader/
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
the temporary filename of the file in which the uploaded file was stored on the server is not the same as source filename. If you pass the temporary filename to SpreadsheetReaderFactory, it could not detect which reader to suit.
One row per line. In default, it will separate fields by tab (\t). You might set a PCRE-pattern to indicate the reader how to take fields.
Posted by 遊手好閒的石頭成
at 2007年03月19日 11:59
It's a very simply library. To use it, you may look at the sources of test case (*Test.php) .
這是非常簡單的工具。看看測試案例的源碼,你就會用了。
Posted by 遊手好閒的石頭成
at 2007年03月23日 09:18
SpreadsheetReader 近期重要更新內容:
Revision 16:
Support MS Excel 2000/XP's XML file.
Notice: Excel 2000/XP's XML file format is a single XML file, and different from Office OpenXML.
支援 MS Excel 2000/XP 的 XML 格式試算表。
注意: MS Excel 2000/XP 的 XML 格式試算表是一種單一XML文件,與 Office OpenXML 不同。
OpenOffice 支持 MS Excel 2000/XP 的XML格式試算表。
同樣是純文字文字格式,但 Excel 2000/XP XML 較 CSV 對資料型態及中日韓文的支持更好。
Revision 21:
Add feature: It can return sheets as associative array.
可以將試算表結果回傳為關聯式陣列。將第一列視為欄位標頭,作為陣列的鍵值。
Revision 24:
Add method: asXml(). This return $sheets as Xml string (Excel XML format). Therefor you can save it or put in a download stream.
可以將 $sheets 轉為 XML 字串 (Excel 2000/XP 的XML格式)。這可讓你將試算表保存為一個 XML 檔案,或加到一個檔案下載的串流中。
Bug fixed:
1. Let factory detect file-type case-insensitive.
2. bug of SpreadsheetReader_Excel: Sometimes, data will contain non-readable chars (I put in $ignoreChar). XML parser will occur a parse error. So we need to strip those non-readable chars.
3.It only output tables which have text in their first cell. Now fix it.
4.When read with READ_ASSOC, it forgets to skip the first Row(fields header) after 2nd sheet.
Posted by 遊手好閒的石頭成
at 2007年06月12日 17:04
Revision 26
IMPORTANT! I rewrite my Excel reader by pure PHP code. Instead of invoking the external reader, jxl.