2018-02-14 20:06:35 +00:00
|
|
|
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
|
|
|
|
|
|
|
let sheetjs = try SheetJSCore();
|
|
|
|
|
|
|
|
try print(sheetjs.version());
|
|
|
|
|
|
|
|
let filenames: [[String]] = [
|
2018-03-13 02:51:54 +00:00
|
|
|
["xlsx", "xlsx"],
|
|
|
|
["xlsb", "xlsb"],
|
|
|
|
["biff8.xls", "xls"],
|
|
|
|
["xml.xls", "xlml"]
|
2018-02-14 20:06:35 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
for fn in filenames {
|
2018-03-13 02:51:54 +00:00
|
|
|
let wb: SJSWorkbook = try sheetjs.readFile(file: "sheetjs." + fn[0]);
|
|
|
|
let ws: SJSWorksheet = try wb.getSheetAtIndex(idx: 0);
|
|
|
|
let csv: String = try ws.toCSV();
|
|
|
|
print(csv);
|
|
|
|
let wbout: String = try wb.writeBStr(bookType: fn[1]);
|
|
|
|
try wbout.write(toFile: "sheetjsswift." + fn[0], atomically: false, encoding: String.Encoding.isoLatin1);
|
2018-02-14 20:06:35 +00:00
|
|
|
}
|