Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/faisalman/simple-excel-js
SimpleExcel.js - WIP client-side script to parse / convert / write XML / CSV / TSV / HTML / JSON / etc formats.
https://github.com/faisalman/simple-excel-js
Last synced: 24 days ago
JSON representation
SimpleExcel.js - WIP client-side script to parse / convert / write XML / CSV / TSV / HTML / JSON / etc formats.
- Host: GitHub
- URL: https://github.com/faisalman/simple-excel-js
- Owner: faisalman
- Created: 2013-03-11T15:03:58.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-11-25T11:53:10.000Z (about 8 years ago)
- Last Synced: 2024-11-10T02:13:35.038Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://faisalman.github.io/simple-excel-js/
- Size: 47.9 KB
- Stars: 190
- Watchers: 15
- Forks: 73
- Open Issues: 14
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-indo-projects - SimpleExcel.js - Client-side script to easily parse / convert / write any Microsoft Excel. (JavaScript)
- awesome-indonesia-repo - SimpleExcel.js - Client-side script to easily parse / convert / write any Microsoft Excel. (JavaScript)
- awesome-vietnam-repo - SimpleExcel.js - Client-side script to easily parse / convert / write any Microsoft Excel. (JavaScript)
README
# SimpleExcel.js
Client-side script to easily parse / convert / write any Microsoft Excel XLSX / XML / CSV / TSV / HTML / JSON / etc formats. As for server-side solution you might want to check [SimpleExcelPHP](https://github.com/faisalman/simple-excel-php)
## Example
```html
// read a CSV file
var csvParser = new SimpleExcel.Parser.CSV();
var fileInput = document.getElementById('fileInput');
// parse when file loaded, then print the result to console
fileInput.addEventListener('change', function (e) {
var file = e.target.files[0];
csvParser.loadFile(file, function () {
console.log(csvParser.getSheet()); // print!
});
});// write an XLSX file
var xlsxWriter = new SimpleExcel.Writer.XLSX();
var xlsxSheet = new SimpleExcel.Sheet();
var Cell = SimpleExcel.Cell;
xlsxSheet.setRecord([
[new Cell('ID', 'TEXT'), new Cell('Nama', 'TEXT'), new Cell('Kode Wilayah', 'TEXT')],
[new Cell(1, 'NUMBER'), new Cell('Kab. Bogor', 'TEXT'), new Cell(1, 'NUMBER')],
[new Cell(2, 'NUMBER'), new Cell('Kab. Cianjur', 'TEXT'), new Cell(1, 'NUMBER')],
[new Cell(3, 'NUMBER'), new Cell('Kab. Sukabumi', 'TEXT'), new Cell(1, 'NUMBER')],
[new Cell(4, 'NUMBER'), new Cell('Kab. Tasikmalaya', 'TEXT'), new Cell(2, 'NUMBER')]
]);
xlsxWriter.insertSheet(xlsxSheet);
// export when button clicked
document.getElementById('fileExport').addEventListener('click', function () {
xlsxWriter.saveFile(); // pop! ("Save As" dialog appears)
});
```
## License
GPLv2 & MIT License
Copyright © 2013 Faisalman <>