forked from protobi/workbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample2.js
More file actions
24 lines (20 loc) · 779 Bytes
/
Copy pathexample2.js
File metadata and controls
24 lines (20 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var XLSX = require('xlsx');
var Workbook = require('./workbook');
///credit http://daveaddey.com/?p=40
function JSDateToExcelDate(inDate) {
return 25569.0 + ((inDate.getTime() - (inDate.getTimezoneOffset() * 60 * 1000)) / (1000 * 60 * 60 * 24));
}
var workbook = new Workbook();
workbook.setCell('Main',0,0,{v: "Hello"});
workbook.setCell('Main',1,1,{v: "Hello"});
workbook.setCell('Main',4,2,{v: "Hello"});
workbook.finalize();
console.log(workbook);
var OUTFILE = '/tmp/wb.xlsx';
var OUTFILE1 = '/tmp/wb1.xlsx';
console.log(workbook)
XLSX.writeFile(workbook, OUTFILE);
console.log("Results written to " + OUTFILE)
var workbook1 = XLSX.readFile(OUTFILE, {cellStyles: true, cellNF: true});
XLSX.writeFile(workbook1, OUTFILE1);
console.log("Results written to " + OUTFILE1)