All Projects → AsperaGmbH → xlsx-reader

AsperaGmbH / xlsx-reader

Licence: other
xlsx-reader is a PHP library for fast and efficient reading of XLSX spreadsheet files. Its focus is on reading the data contained within XLSX files, disregarding all document styling beyond that which is strictly necessary for data type recognition. It is built to be usable for very big XLSX files in the magnitude of multiple GBs.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to xlsx-reader

Php Ext Xlswriter
🚀 PHP Extension for creating and reader XLSX files.
Stars: ✭ 1,734 (+4235%)
Mutual labels:  excel, xlsx, xlsx-files, xlsxreader
XToolset
Typed import, and export XLSX spreadsheet to JS / TS. Template-based create, render, and export data into excel files.
Stars: ✭ 110 (+175%)
Mutual labels:  excel, xlsx, spreadsheet, xlsx-parser
Sheetjs
📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Stars: ✭ 28,479 (+71097.5%)
Mutual labels:  excel, xlsx, spreadsheet
Xlnt
📊 Cross-platform user-friendly xlsx library for C++11+
Stars: ✭ 876 (+2090%)
Mutual labels:  excel, xlsx, spreadsheet
Documentserver
ONLYOFFICE Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
Stars: ✭ 2,335 (+5737.5%)
Mutual labels:  excel, xlsx, spreadsheet
Docjure
Read and write Office documents from Clojure
Stars: ✭ 510 (+1175%)
Mutual labels:  excel, xlsx, spreadsheet
Reogrid
Fast and powerful .NET spreadsheet component, support data format, freeze, outline, formula calculation, chart, script execution and etc. Compatible with Excel 2007 (.xlsx) format and working on .NET 3.5 (or client profile), WPF and Android platform.
Stars: ✭ 532 (+1230%)
Mutual labels:  excel, xlsx, spreadsheet
Desktopeditors
An office suite that combines text, spreadsheet and presentation editors allowing to create, view and edit local documents
Stars: ✭ 1,008 (+2420%)
Mutual labels:  excel, xlsx, spreadsheet
excel validator
Python script to validate data in Excel files
Stars: ✭ 14 (-65%)
Mutual labels:  excel, xlsx, spreadsheet
Phpspreadsheet
A pure PHP library for reading and writing spreadsheet files
Stars: ✭ 10,627 (+26467.5%)
Mutual labels:  excel, xlsx, spreadsheet
Excelize
Golang library for reading and writing Microsoft Excel™ (XLSX) files.
Stars: ✭ 10,286 (+25615%)
Mutual labels:  excel, xlsx, spreadsheet
spreadcheetah
SpreadCheetah is a high-performance .NET library for generating spreadsheet (Microsoft Excel XLSX) files.
Stars: ✭ 107 (+167.5%)
Mutual labels:  excel, xlsx, spreadsheet
J
❌ Multi-format spreadsheet CLI (now merged in http://github.com/sheetjs/js-xlsx )
Stars: ✭ 343 (+757.5%)
Mutual labels:  excel, xlsx, spreadsheet
Unioffice
Pure go library for creating and processing Office Word (.docx), Excel (.xlsx) and Powerpoint (.pptx) documents
Stars: ✭ 3,111 (+7677.5%)
Mutual labels:  excel, xlsx, spreadsheet
Readxl
Read excel files (.xls and .xlsx) into R 🖇
Stars: ✭ 585 (+1362.5%)
Mutual labels:  excel, xlsx, spreadsheet
ExcelFormulaBeautifier
Excel Formula Beautifer,make Excel formulas more easy to read,Excel公式格式化/美化,将Excel公式转为易读的排版
Stars: ✭ 27 (-32.5%)
Mutual labels:  excel, xlsx, spreadsheet
Luckysheet
Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source.
Stars: ✭ 9,772 (+24330%)
Mutual labels:  excel, xlsx, spreadsheet
fxl.js
ƛ fxl.js is a data-oriented JavaScript spreadsheet library. It provides a way to build spreadsheets using modular, lego-like blocks.
Stars: ✭ 27 (-32.5%)
Mutual labels:  excel, xlsx, spreadsheet
Documentbuilder
ONLYOFFICE Document Builder is powerful text, spreadsheet, presentation and PDF generating tool
Stars: ✭ 61 (+52.5%)
Mutual labels:  excel, xlsx, spreadsheet
Xlsx
Fast and reliable way to work with Microsoft Excel™ [xlsx] files in Golang
Stars: ✭ 132 (+230%)
Mutual labels:  excel, xlsx, spreadsheet

xlsx-reader

xlsx-reader is an extension of the XLSX-targeted spreadsheet reader that is part of spreadsheet-reader.

It delivers functionality to efficiently read in data contained within the given XLSX file.

The focus of this library is on delivering data contained in XLSX spreadsheet cells, not the document's styling. As such, the library offers no support for XLSX capabilities that aren't strictly necessary to achieve this goal. Only basic cell value formatting and shared string functionalities are supported.

Requirements

Installation using Composer

The package is available on Packagist. You can install it using Composer.

composer require aspera/xlsx-reader

Usage

All data is read from the file sequentially, with each row being returned as an array of columns.

<?php
use Aspera\Spreadsheet\XLSX\Reader;

$reader = new Reader();
$reader->open('example.xlsx');

foreach ($reader as $row) {
    print_r($row);
}

$reader->close();

XLSX files with multiple worksheets are also supported. The method getSheets() returns an array with sheet indexes as keys and Worksheet objects as values. The method changeSheet($index) is used to switch between sheets to read.

<?php
use Aspera\Spreadsheet\XLSX\Reader;

$reader = new Reader();
$reader->open('example.xlsx');

$sheets = $reader->getSheets();
foreach ($sheets as $index => $sheet_data) {
    $reader->changeSheet($index);
    echo 'Sheet #' . $index . ': ' . $sheet_data->getName();

    // Note: Any call to changeSheet() resets the current read position to the beginning of the selected sheet.
    foreach ($reader as $row_number => $row) {
        echo 'Row #' . $row_number . ': ' . print_r($row, true);
    }
}

$reader->close();

Options to tune the reader's behavior and output can be specified via a ReaderConfiguration instance.

For a full list of supported options and their effects, consult the in-code documentation of ReaderConfiguration.

<?php
use Aspera\Spreadsheet\XLSX\Reader;
use Aspera\Spreadsheet\XLSX\ReaderConfiguration;
use Aspera\Spreadsheet\XLSX\ReaderSkipConfiguration;

$reader_configuration = (new ReaderConfiguration())
  ->setTempDir('C:/Temp/')
  ->setSkipEmptyCells(ReaderSkipConfiguration::SKIP_EMPTY)
  ->setReturnDateTimeObjects(true)
  ->setCustomFormats(array(20 => 'hh:mm'));
// For a full list of supported options and their effects, consult the in-code documentation of ReaderConfiguration.

$spreadsheet = new Reader($reader_configuration);

Notes about library performance

XLSX files use so-called "shared strings" to optimize file sizes for cases where the same string is repeated multiple times. For larger documents, this list of shared strings can become quite large, causing either performance bottlenecks or high memory consumption when parsing the document.

To deal with this, the reader selects sensible defaults for maximum RAM consumption. Once this memory limit has been exhausted, the file system is used for further optimization strategies.

To configure this behavior in detail, e.g. to increase the amount of memory available to the reader, a SharedStringsConfiguration instance can be attached to the ReaderConfiguration instance supplied to the reader's constructor.

For a full list of supported options and their effects, consult the in-code documentation of SharedStringsConfiguration.

<?php
use Aspera\Spreadsheet\XLSX\Reader;
use Aspera\Spreadsheet\XLSX\ReaderConfiguration;
use Aspera\Spreadsheet\XLSX\SharedStringsConfiguration;

$shared_strings_configuration = (new SharedStringsConfiguration())
    ->setCacheSizeKilobyte(16 * 1024)
    ->setUseOptimizedFiles(false);
// For a full list of supported options and their effects, consult the in-code documentation of SharedStringsConfiguration.

$reader_configuration = (new ReaderConfiguration())
  ->setSharedStringsConfiguration($shared_strings_configuration);

$spreadsheet = new Reader($reader_configuration);

Notes about unsupported features

This reader's purpose is to allow reading of basic data (text, numbers, dates...) from XLSX documents. As such, there are no plans to extend support to include all features available for XLSX files. Only a minimal subset of XLSX capabilities is supported.

In particular, the following should be noted in regard to unsupported features:

  • Display cell width is disregarded. As a result, in cases in which popular xlsx editors would shorten values using scientific notation or "#####"-placeholders, the reader will return un-shortened values instead.
  • Files with multiple internal shared strings files are not supported.
  • Files with multiple internal styles definition files are not supported.
  • Fractions are only partially supported. The results delivered by the reader might be slightly off from the original input.

Licensing

All the code in this library is licensed under the MIT license as included in the LICENSE.md file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].