simplexls

所属分类:其他
开发工具:PHP
文件大小:0KB
下载次数:0
上传日期:2022-10-04 16:54:10
上 传 者sh-1993
说明:  从旧格式的Excel XLS文件中分析和检索数据。MS Excel 97工作簿PHP阅读器。,
(Parse and retrieve data from old format Excel XLS files. MS Excel 97 workbooks PHP reader.,)

文件列表:
LICENSE (1071, 2023-11-13)
composer.json (559, 2023-11-13)
examples/ (0, 2023-11-13)
examples/01-basic_usage.php (300, 2023-11-13)
examples/02-rows_with_header_values_as_keys.php (1183, 2023-11-13)
examples/books.xls (27648, 2023-11-13)
license.md (1112, 2023-11-13)
src/ (0, 2023-11-13)
src/SimpleXLS.php (52321, 2023-11-13)

# SimpleXLS class 0.10.4 [](https://packagist.org/packages/shuchkin/simplexls) Parse and retrieve data from old Excel .XLS files. MS Excel 97-2003 workbooks PHP reader. PHP BIFF reader. No additional extensions needed (internal olereader).
Modern .XLSX php reader [here](https://github.com/shuchkin/simplexlsx). *Hey, bro, please ★ the package for my motivation :) and [donate](https://opencollective.com/simplexlsx) for more motivation!* [**Sergey Shuchkin**](https://www.patreon.com/shuchkin) 2016-2022
## Basic Usage ```php if ( $xls = SimpleXLS::parseFile('book.xls') ) { print_r( $xls->rows() ); // echo $xls->toHTML(); } else { echo SimpleXLS::parseError(); } ``` ``` Array ( [0] => Array ( [0] => ISBN [1] => title [2] => author [3] => publisher [4] => ctry ) [1] => Array ( [0] => 618260307 [1] => The Hobbit [2] => J. R. R. Tolkien [3] => Houghton Mifflin [4] => USA ) ) ``` ## Installation ``` composer require shuchkin/simplexls ``` or download class [here](https://github.com/shuchkin/simplexls/blob/master/src/SimpleXLS.php) From 0.10 version supports PHP 7.1+, PHP 8+ [0.9.x](https://github.com/shuchkin/simplexls/tags) supports PHP 5.3+ ## Examples ### XLS to html table ```php echo SimpleXLS::parse('book.xls')->toHTML(); ``` or ```php if ( $xls = SimpleXLS::parse('book.xls') ) { echo ''; foreach( $xls->rows() as $r ) { echo ''; } echo '
'.implode('', $r ).'
'; } else { echo SimpleXLS::parseError(); } ``` ### Sheet names ```php if ( $xls = SimpleXLS::parseFile('book.xls') ) { print_r( $xls->sheetNames() ); print_r( $xls->sheetName( $xls->activeSheet ) ); } ``` ``` Array ( [0] => Sheet 1 [1] => Sheet 2 [2] => Sheet 3 ) Sheet 2 ``` ### Sheets info ```php if ( $xls = SimpleXLS::parseFile('book.xls') ) { print_r( $xls->boundsheets ); } ``` ``` Array ( [0] => Array ( [name] => Sheet 1 [offset] => 15870 [hidden] => [active] => ) [1] => Array ( [name] => Sheet 2 [offset] => 16308 [hidden] => 1 [active] => 1 ) [2] => Array ( [name] => Sheet 3 [offset] => 16746 [hidden] => [active] => ) ) ``` ### Classic OOP style ```php $xls = new SimpleXLS('books.xls'); if ($xls->success()) { print_r( $xls->rows() ); } else { echo 'xls error: '.$xls->error(); } ``` ## Debug ```php ini_set('error_reporting', E_ALL ); ini_set('display_errors', 1 ); //header('Content-Type: text/html; charset=utf-8'); $xls = SimpleXLSX::parse('books.xls', false, true ); print_r( $xls->rows() ); print_r( $xls->sheets ); ``` ## History ``` 0.10.4 (2023-11-13) more compatible with PHP 8.1 0.10.3 (2022-10-04) namespaced examples 0.10.2 (2022-09-01) fixed percent values 0.10.1 (2022-04-04) PHP 7.1+, PHP 8.0+ 0.9.15 (2021-12-01) added $xls->sheetNames(), $xls->sheetName( $index ), $xls->activeSheet added $limit in $xls->rows( $sheetIndex, $limit = 0 ) more examples in README 0.9.14 (2021-11-04) Detect datetime format 0.9.13 (2021-09-21) Fixed éàù... in sheet names, added flag *hidden* in $xls->boundsheets info 0.9.12 (2021-09-20) Fixed éàù... 0.9.11 (2021-09-02) Added *Rows with header values as keys* example 0.9.10 (2021-05-19) SimpleXLSX to SimpleXLS in example 0.9.9 (2021-03-04) Added $xls->toHTML() 0.9.8 (2021-03-04) Fixed skipping first row & col, fixed datetime format in unicode 0.9.7 (2021-02-26) Added ::parseFile(), ::parseData() 0.9.6 (2020-12-01) Fixed README 0.9.5 (2020-01-16) Fixed negative number values and datetime values 0.9.4 (2019-03-14) Added git Tag for prevent composer warning 0.9.3 (2019-02-19) Fixed datetime detection 0.9.2 (2018-11-15) GitHub realese, composer ```

近期下载者

相关文件


收藏者