Giter Club home page Giter Club logo

excelerate's Introduction

Excelerate

Description

This library is designed to be lightweight, and have minimal memory usage.

Based on:

It is designed to read an write Excel compatible spreadsheets in (Office 2007+) XLSX format:

  • supports PHP 8+
  • takes UTF-8 encoded input
  • multiple worksheets
  • supports currency/date/numeric cell formatting, simple and array formulas
  • supports basic cell styling
  • supports writing huge 100K+ row spreadsheets

Documentation:

Usage

Installing

Use Composer:

composer require bcostea/excelerate

Reading

Open an Excel file:

$xlsx = new XLSXReader('sample.xlsx');

Get a list of the sheets:

$sheets = $xlsx->getSheetNames();

Get the data from a sheet:

$data = $xlsx->getSheetData('Sales');

Writing

Simple example:

$data = array(
    array('year','month','amount'),
    array('2003','1','220'),
    array('2003','2','153.5'),
);

$writer = new XLSXWriter();
$writer->writeSheet($data);
$writer->writeToFile('output.xlsx');

Simple/Advanced Cell Formats:

$header = array(
  'created'=>'date',
  'product_id'=>'integer',
  'quantity'=>'#,##0',
  'amount'=>'price',
  'description'=>'string',
  'tax'=>'[$$-1009]#,##0.00;[RED]-[$$-1009]#,##0.00',
);
$data = array(
    array('2015-01-01',873,1,'44.00','misc','=D2*0.05'),
    array('2015-01-12',324,2,'88.00','none','=D3*0.05'),
);

$writer = new XLSXWriter();
$writer->writeSheetHeader('Sheet1', $header );
foreach($data as $row)
	$writer->writeSheetRow('Sheet1', $row );
$writer->writeToFile('example.xlsx');

Simple cell formats map to more advanced cell formats

simple formats format code
string @
integer 0
date YYYY-MM-DD
datetime YYYY-MM-DD HH:MM:SS
time HH:MM:SS
price #,##0.00
dollar [$$-1009]#,##0.00;[RED]-[$$-1009]#,##0.00
euro #,##0.00 [$€-407];[RED]-#,##0.00 [$€-407]

Basic cell styles have been available since version 0.30

style allowed values
font Arial, Times New Roman, Courier New, Comic Sans MS
font-size 8,9,10,11,12 ...
font-style bold, italic, underline, strikethrough or multiple ie: 'bold,italic'
border left, right, top, bottom, or multiple ie: 'top,left'
border-style thin, medium, thick, dashDot, dashDotDot, dashed, dotted, double, hair, mediumDashDot, mediumDashDotDot, mediumDashed, slantDashDot
border-color #RRGGBB, ie: #ff99cc or #f9c
color #RRGGBB, ie: #ff99cc or #f9c
fill #RRGGBB, ie: #eeffee or #efe
halign general, left, right, justify, center
valign bottom, center, distributed
textRotation 0-360

excelerate's People

Contributors

andrewkesper avatar bcostea avatar c-schmitz avatar eom avatar farhantahir avatar fliespl avatar fugi avatar fulgurio avatar goktugozturk avatar ivanbarlog avatar jpastoor avatar ldav avatar lewa avatar lieszkol avatar lourdas avatar malvineous avatar marktinsley avatar mk-j avatar radstake avatar sebastiankalwa avatar shinychang avatar stephane-rouleau avatar stof avatar unamatasanatarai avatar xrobau avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.