PHPackages                             tdchien/simplexls - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. tdchien/simplexls

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

tdchien/simplexls
=================

Parse and retrieve data from old format Excel XLS files. MS Excel 97 workbooks PHP reader.

03PHP

Since Jun 2Pushed 2y agoCompare

[ Source](https://github.com/tdchien/simplexls)[ Packagist](https://packagist.org/packages/tdchien/simplexls)[ RSS](/packages/tdchien-simplexls/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

SimpleXLS class 0.10.3
======================

[](#simplexls-class-0103)

[![](https://camo.githubusercontent.com/854cd9307a90462938c945044a3f5cb297c0d61992369d51a02170215ec721ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73687563686b696e2f73696d706c65786c73)](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
-----------

[](#basic-usage)

```
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
------------

[](#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
--------

[](#examples)

### XLS to html table

[](#xls-to-html-table)

```
echo SimpleXLS::parse('book.xls')->toHTML();
```

or

```
if ( $xls = SimpleXLS::parse('book.xls') ) {
	echo '';
	foreach( $xls->rows() as $r ) {
		echo ''.implode('', $r ).'';
	}
	echo '';
} else {
	echo SimpleXLS::parseError();
}
```

### Sheet names

[](#sheet-names)

```
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

[](#sheets-info)

```
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

[](#classic-oop-style)

```
$xls = new SimpleXLS('books.xls');
if ($xls->success()) {
	print_r( $xls->rows() );
} else {
	echo 'xls error: '.$xls->error();
}
```

Debug
-----

[](#debug)

```
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
-------

[](#history)

```
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

```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 88.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/67efca6a33c2a7d87493090902a3c09d80a39edd328fa2c994d904c2d1881d6b?d=identicon)[tdchien](/maintainers/tdchien)

---

Top Contributors

[![shuchkin](https://avatars.githubusercontent.com/u/315872?v=4)](https://github.com/shuchkin "shuchkin (31 commits)")[![tdchien](https://avatars.githubusercontent.com/u/1614393?v=4)](https://github.com/tdchien "tdchien (3 commits)")[![Maikuolan](https://avatars.githubusercontent.com/u/12571108?v=4)](https://github.com/Maikuolan "Maikuolan (1 commits)")

### Embed Badge

![Health badge](/badges/tdchien-simplexls/health.svg)

```
[![Health](https://phpackages.com/badges/tdchien-simplexls/health.svg)](https://phpackages.com/packages/tdchien-simplexls)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
