PHP Classes

File: makeconfig.php

Recommend this page to a friend!
  Classes of Karl Holz   PHP Convert Excel to JSON   makeconfig.php   Download  
File: makeconfig.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Convert Excel to JSON
Convert data from Excel spreadsheet to JSON format
Author: By
Last change: Update of makeconfig.php
Date: 11 months ago
Size: 972 bytes


Class file image Download
require_once 'excelMap.class.php';
$e=new excel2JSON();
 * you will need to set the $file variable for this to work
$e->set_excel($file, 'false');
 * get a list of excel sheets and add them to $path
foreach ($e->excel_sheets['title'] as $k => $v) $path[]=$v;
 * make the ini configuration for each sheet,
 * only file and sheet, plus the cells with data are set as keys
foreach ($path as $p){
$e=new excel2JSON();
$e->set_excel($file, 'false');
// print_r($excel);

    foreach (
$excel as $k =>$v) $ini.="$k=\"$k\"\n";
 * write configuration file as config.ini
file_put_contents('config.ini', $ini);
 * show newly made file
if (basename($_SERVER['SCRIPT_NAME']) == 'makeconfig.php')echo "<pre>".$ini."</pre>";