PHPackages                             label305/xlsx-extractor - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. label305/xlsx-extractor

ActiveLibrary[File &amp; Storage](/categories/file-storage)

label305/xlsx-extractor
=======================

PHP library for extracting and replacing string data in .xlsx files.

0.2.4(2y ago)04.9k↓50%Apache-2.0PHPPHP ^8.0

Since Dec 1Pushed 2y ago3 watchersCompare

[ Source](https://github.com/Label305/XlsxExtractor)[ Packagist](https://packagist.org/packages/label305/xlsx-extractor)[ Docs](https://github.com/Label305/XlsxExtractor)[ RSS](/packages/label305-xlsx-extractor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (16)Used By (0)

Xlsx Extractor [![Build Status](https://camo.githubusercontent.com/4115a31bdca773ddc9f8e30cdb998889ef5911077e756ab8eb2765314d332fb9/68747470733a2f2f7472617669732d63692e6f72672f4c6162656c3330352f586c7378457874726163746f722e737667)](https://travis-ci.org/Label305/XlsxExtractor)
====================================================================================================================================================================================================================================================================================

[](#xlsx-extractor-)

PHP library for extracting and replacing string data in .xlsx files. Pptx files are zip archives filled with XML documents and assets. Their format is described by [OOXML](http://nl.wikipedia.org/wiki/Office_Open_XML). This library only manipulates the `xl/sharedStrings.xml` file.

Composer installation
---------------------

[](#composer-installation)

```
"require": {
    "label305/xlsx-extractor": "0.2.*"
}
```

Requirements
------------

[](#requirements)

- PHP 8.0
- PHP ext-dom
- PHP ext-zip
- PHP ext-libxml

Basic usage
-----------

[](#basic-usage)

Import the basic classes.

```
use Label305\XlsxExtractor\Basic\BasicExtractor;
use Label305\XlsxExtractor\Basic\BasicInjector;
```

First we need to extract all the contents from an existing `xlsx` file. This can be done using the `BasicExtractor`. Calling `extractStringsAndCreateMappingFile` will create a new file which name you pass in the second argument. This new file contains references so the library knows where to later inject the altered text back into.

```
$extractor = new BasicExtractor();
$mapping = $extractor->extractStringsAndCreateMappingFile(
    'simple.xlsx',
    'simple-extracted.xlsx'
  );
```

Now that you have extracted contents you can inspect the content of the resulting `$mapping` array. And if you wish to change the content you can simply modify it. The array key maps to a symbol in the `simple-extracted.xlsx`.

```
echo $mapping[0]; // Slide number one
```

Now after you changed your content, you can save it back to a new file. In this case that file is `simple-injected.xlsx`.

```
$mapping[0] = "Slide number one";

$injector = new BasicInjector();
$injector->injectMappingAndCreateNewFile(
    $mapping,
    'simple-extracted.xlsx',
    'simple-injected.xlsx'
  );
```

Advanced usage
--------------

[](#advanced-usage)

The library is also equiped with a `DecoratedTextExtractor` and `DecoratedTextInjector` with which you can manipulate basic paragraph styling like bold, italic and underline. You can also use the `SharedString` objects to distinguish logical groupings of text.

```
$extractor = new DecoratedTextExtractor();
$mapping = $extractor->extractStringsAndCreateMappingFile(
    'markup.xlsx',
    'markup-extracted.xlsx'
  );

$firstSharedString = $mapping[0]; // SharedString object
$firstSharedStringPart = $firstParagraph[0]; // SharedStringPart object

$firstSharedStringPart->italic = true;
$firstSharedStringPart->bold = false;
$firstSharedStringPart->underline = true;

echo $firstSharedStringPart->text; // The quick brown fox jumps over the lazy dog
$firstSharedStringPart->text = "Several fabulous dixieland jazz groups played with quick tempo.";

$injector = new DecoratedTextInjector();
$injector->injectMappingAndCreateNewFile(
    $mapping,
    'markup-extracted.xlsx',
    'markup-injected.xlsx'
  );
```

License
-------

[](#license)

Copyright 2020 Label305 B.V.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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.

###  Release Activity

Cadence

Every ~96 days

Recently: every ~191 days

Total

14

Last Release

738d ago

PHP version history (4 changes)0.1.0PHP &gt;=7.1.0

0.2.0PHP 8.0.\*

0.2.3PHP 8.1.\*|8.0.\*

0.2.4PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/fade7c662ebe1bed72e075de6735949bdecfb1cd185cd4d20963c1b6be1df6f4?d=identicon)[xander\_peuscher](/maintainers/xander_peuscher)

---

Top Contributors

[![xanderpeuscher](https://avatars.githubusercontent.com/u/1401193?v=4)](https://github.com/xanderpeuscher "xanderpeuscher (18 commits)")[![lucBleijenberg](https://avatars.githubusercontent.com/u/48120882?v=4)](https://github.com/lucBleijenberg "lucBleijenberg (1 commits)")[![nvelthorst](https://avatars.githubusercontent.com/u/3592114?v=4)](https://github.com/nvelthorst "nvelthorst (1 commits)")

---

Tags

xlsxmapperextractor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/label305-xlsx-extractor/health.svg)

```
[![Health](https://phpackages.com/badges/label305-xlsx-extractor/health.svg)](https://phpackages.com/packages/label305-xlsx-extractor)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M123](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[raulfraile/distill

Smart compressed files extractor

228190.4k9](/packages/raulfraile-distill)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M61](/packages/creocoder-yii2-flysystem)

PHPackages © 2026

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