sheetjs-clone/demos/altjs/qjs.js
SheetJS 9aabf36142 version bump 0.14.4
- CFB update (fixes #1149 h/t @xjnotxj)
- SYLK character encoding (fixes #1544 h/t @Slayess)
- DBF and SYLK ANSI codepage support
2019-07-20 23:32:02 -04:00

26 lines
596 B
JavaScript
Executable File

#!/usr/bin/env qjs
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
/* load XLSX */
std.global.global = std.global;
std.loadScript("xlsx.full.min.js");
/* read contents of file */
var rh = std.open("sheetjs.xlsx", "rb");
rh.seek(0, std.SEEK_END);
var sz = rh.tell();
var ab = new ArrayBuffer(sz);
rh.seek();
rh.read(ab, 0, sz);
rh.close();
/* parse file */
var wb = XLSX.read(ab, {type: 'array'});
/* write array */
var out = XLSX.write(wb, {type: 'array'});
/* write contents to file */
var wh = std.open("sheetjs.qjs.xlsx", "wb");
wh.write(out, 0, out.byteLength);
wh.close();