PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of dbforch   PHP CSV XLS Converter   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Demo script
Class: PHP CSV XLS Converter
Convert data from CSV files to Excel XLS format
Author: By
Last change: Generates a test csv file and noticing the user that PHPExcel ( is required to run this demo.
Date: 11 years ago
Size: 748 bytes


Class file image Download

// required class
require_once "CSVToExcelConverter2.class.php";
// requires the PHPExcel library (
  // require_once "path/to/PHPExcel.php";

  // source csv file
$csv_file = 'test.csv';
// create the source test csv
if(($fh = fopen($csv_file, 'w+')) !== false) {
fputcsv($fh, array(
  else {
"unable to perform demo, test csv file could not be created";
// start converting
  // xls filename will be automatically generated
$converter = new CSVToExcelConverter2($csv_file);