PHP Classes

PHP Excel XML Export: Generate Excel spreadsheets in XML format

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 415 This week: 1All time: 6,442 This week: 560Up
Version License PHP version Categories
excel-xml 1GNU General Publi...5PHP 5, Files and Folders
Description 

Author

This class can generate Excel spreadsheets in XML format.

It takes arrays with the definition of the titles and data cells and generates a XML document in Excel spreadsheet format with the specified data.

The class can detect the type of data for each cell based on the format of the value. Currently the class can detect cell data of types string, number, date, timestamp or time.

The generate Excel document can be served for download or saved to a given file.

Picture of Gianluca Zanferrari
  Performance   Level  
Name: Gianluca Zanferrari <contact>
Classes: 19 packages by
Country: The Netherlands The Netherlands
Age: 57
All time rank: 1674 in The Netherlands The Netherlands
Week rank: 109 Up2 in The Netherlands The Netherlands Up
Innovation award
Innovation award
Nominee: 5x

Example

<?php
require_once('class.excel_xml.php');

$xls = new excel_xml; // initiate the class

$xls->set_titles(array('title one','title two','title three')); // optional: sets the titles of the spreadsheet columns

// adding 6 rows to the spreadsheet

$xls->add_row(array('text',-22.2,'bla bla')); // first row

$xls->add_row(array('1500.3',14.5,'bingo!')); // second row

$xls->add_row(array('2014-11-01',14.5,'a date in cell A4!!')); // third row

$xls->add_row(array('Timestamp in cell C5',14.5,'2014-11-01 12:00:10','extra data, a longer text')); // fourth row

$xls->add_row(array()); // fifth (empty) row

$xls->add_row(array('Time in cell C7',14.5,'12:00:10'));// sixth row

// writes output to file.xml (check please write permissions)
//$xls->output('file'); // comment it out to enable writing

// send the data to the browser
$xls->output();


  Files folder image Files  
File Role Description
Plain text file class.excel_xml.php Class class itself
Accessible without login Plain text file example.excel_xml.php Example example

 Version Control Unique User Downloads Download Rankings  
 0%
Total:415
This week:1
All time:6,442
This week:560Up