forked from sheetjs/sheetjs
SheetJS
5de62a947f
- add BOM to `stream.to_csv` (fixes #1024 h/t @hr5959) - `utils.format_cell` type (h/t @victorj2307) - duktape niggles - demo cleanup
13 lines
410 B
TypeScript
13 lines
410 B
TypeScript
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
|
/* vim: set ts=2: */
|
|
|
|
import * as XLSX from 'xlsx';
|
|
|
|
const { read, utils: { sheet_to_json } } = XLSX;
|
|
|
|
export function readFirstSheet(data: any, options: XLSX.ParsingOptions): any[][] {
|
|
const wb: XLSX.WorkBook = read(data, options);
|
|
const ws: XLSX.WorkSheet = wb.Sheets[wb.SheetNames[0]];
|
|
return sheet_to_json(ws, { header: 1, raw: true });
|
|
}
|