forked from sheetjs/docs.sheetjs.com
26 lines
607 B
JavaScript
26 lines
607 B
JavaScript
|
/* sheetjs (C) 2013-present SheetJS -- https://sheetjs.com */
|
||
|
/* load XLSX */
|
||
|
import * as std from "std";
|
||
|
globalThis.global = globalThis;
|
||
|
std.loadScript("xlsx.full.min.js");
|
||
|
|
||
|
/* read contents of file */
|
||
|
var rh = std.open("pres.numbers", "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);
|
||
|
|
||
|
/* write XLSX */
|
||
|
var out = XLSX.write(wb, {bookType: "xlsx", type: "array"});
|
||
|
|
||
|
/* write contents to file */
|
||
|
var wh = std.open("SheetJSQuick.xlsx", "wb");
|
||
|
wh.write(out, 0, out.byteLength);
|
||
|
wh.close();
|