PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Craig Smith  >  Basic Excel  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Basic Excel
Import and export Excel files to XLS, XLSX and CSV
Author: By
Last change:
Date: 1 year ago
Size: 525 bytes
 

Contents

Class file image Download
<?php

require_once('BasicExcel/Reader.php');
\
BasicExcel\Reader::registerAutoloader();


$data = array(
    array(
'Nr.', 'Name', 'E-Mail'),
    array(
1, 'Jane Smith', 'jane.smith@fakemail.com'),
    array(
2, 'John Smith', 'john.smith@fakemail.com'));

try {
   
$csvwriter = new \BasicExcel\Writer\Csv(); //or \Xsl || \Xslx
   
$csvwriter->fromArray($data);
   
//$csvwriter->writeFile('myfilename.csv');
    //OR
   
$csvwriter->download('myfilename.csv');
} catch (
Exception $e) {
    echo
$e->getMessage();
    exit;
}