Details
{startverticalbanner}
# Excel2JSON is an Excel XML parser to JSON document
This class will allow you to use your excel workbook data in your Javascript/jQuery and other web applications.
It's really simple to use, you can instantiate the class with the excel file you want to read, the file must
be ooxml, normally with an xlsx or xlsm file extention MS Excel 2007.
I have done some work of updating the current class and added a configuration generator so that you can add name to cell
mapping. The configuration is in INI format and will be based on the Excel file name; eg test.xslt will make test.ini.
The sheet name will be in the [] and each cell will be listed bellow
[SheetName]
A2="fname"
B2="lname"
; commented out map
;C2="mname"
Check out the index.php to see the debug output
### Won't work with excel (xls) docs exported with:
- Apache Open office (excel 2003 XML save as clashes)
- Numbers
- Libre Office (excel 2003 XML save as clashes)
I made test.xlsx with Oxygen XML, and edited it with LibreOffice. it is the test excel file provided with this class
***
To see this class in action, view one of the test php docs on your webserver and view it's code
***
Note: if you get an error with the JSON output, set_excel with a second argument as seen bellow
$e->set_excel($file, 'false');
other wise use
$e->set_excel($file);
***
value dump - test.php => dumps class values
### Show how to use excel data without JSON print out
- $e->filter_cells()
- $e->filter_data()
***
### Sheets test - print_sheets.php => on by default if worksheet not found or set.
Prints out a JSON document of a list of excel workbook sheets
require_once 'excelMap.class.php';
$e=new excel2JSON();
//$e->set_excel($file);
$e->set_excel($file, 'false');
$e->print_sheets();
***
### Data test - print_sheet_data.php
Prints out a JSON document of excel worksheet cell data in detail
require_once 'excelMap.class.php';
$e=new excel2JSON();
//$e->set_excel($file);
$e->set_excel($file, 'false');
$e->load_sheet($sheet);
$e->load_sheet_data();
$e->print_sheet_data();
***
### Cell test - print_sheet_cells.php
Prints out a JSON document of excel worksheet cell and their values
require_once 'excelMap.class.php';
$e=new excel2JSON();
//$e->set_excel($file);
$e->set_excel($file, 'false');
$e->load_sheet($sheet);
$e->load_sheet_data();
$e->print_sheet_cells();
***
### Rows test - print_sheet_rows.php
Prints out a JSON document of excel worksheet cell and values grouped into rows
require_once 'excelMap.class.php';
$e=new excel2JSON();
//$e->set_excel($file);
$e->set_excel($file, 'false');
$e->load_sheet($sheet);
$e->load_sheet_data();
$e->print_sheet_rows();
***
### Data filter test - print_filter_data.php
Prints out a JSON document of excel worksheet cell data in detail, only cells added to cell list will be displayed
require_once 'excelMap.class.php';
$e=new excel2JSON();
//$e->set_excel($file);
$e->set_excel($file, 'false');
$e->load_sheet($sheet);
$e->load_sheet_data();
$e->add_cell_list('A1');
$e->add_cell_list('A2');
$e->add_cell_list('B2');
$e->add_cell_list('A4');
$e->add_cell_list('B4');
$e->print_filter_data();
***
### Cell filter test - print_filter_cells.php
Prints out a JSON document of excel worksheet cell and their values, only cells added to cell list will be displayed
require_once 'excelMap.class.php';
$e=new excel2JSON();
//$e->set_excel($file);
$e->set_excel($file, 'false');
$e->load_sheet($sheet);
$e->load_sheet_data();
$e->add_cell_list('A1');
$e->add_cell_list('A2');
$e->add_cell_list('B2');
$e->add_cell_list('A4');
$e->add_cell_list('B4');
$e->print_filter_cells(); |
|
Name: |
PHP Convert Excel to JSON |
Base name: |
excel2json |
Description: |
Convert data from Excel spreadsheet to JSON format |
Version: |
1.0.3 |
PHP version: |
5.3 |
License: |
Custom (specified in a license file) |
All time users: |
1712 users |
All time rank: |
2265 |
Week users: |
1 user |
Week rank: |
328  |
|
|
Import excel file (xlsx format) into mysql database
I need to import excel data into database
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.
|
Files |
|
File |
Role |
Description |
dist (1 directory) |
xsl (4 files) |
Basic.test.php |
Example |
Example script |
excelMap.class.php |
Class |
excel2JSON class |
index.php |
Example |
Example script |
LICENCE.txt |
Lic. |
Apache 2 licence |
makeconfig.php |
Example |
Example script |
print_filter_cells.php |
Example |
cell filter test - print_filter_cells.php
Prints out a JSON document of excel worksheet cell and their values, only cells added to cell list will be displayed |
print_filter_data.php |
Example |
data filter test - print_filter_data.php
Prints out a JSON document of excel worksheet cell data in detail, only cells added to cell list will be displayed |
print_sheets.php |
Example |
sheets test - print_sheets.php => on by default if worksheet not found or set.
Prints out a JSON document of a list of excel workbook sheets |
print_sheet_cells.php |
Example |
cell test - print_sheet_cells.php
Prints out a JSON document of excel worksheet cell and their values |
print_sheet_data.php |
Example |
data test - print_sheet_data.php
Prints out a JSON document of excel worksheet cell data in detail |
print_sheet_rows.php |
Example |
rows test - print_sheet_rows.php
Prints out a JSON document of excel worksheet cell and values grouped into rows |
README |
Doc. |
Updated Readme |
test.ini |
Data |
Auxiliary data |
File |
Role |
Description |
css (2 files) |