mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com> Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> Co-authored-by: Adela Almasan <adela.almasan@grafana.com>
13 lines
372 B
TypeScript
13 lines
372 B
TypeScript
import { read, utils } from 'xlsx';
|
|
|
|
import { ArrayDataFrame, DataFrame } from '@grafana/data';
|
|
|
|
export function readSpreadsheet(file: ArrayBuffer): DataFrame[] {
|
|
const wb = read(file, { type: 'buffer' });
|
|
return wb.SheetNames.map((name) => {
|
|
const frame = new ArrayDataFrame(utils.sheet_to_json(wb.Sheets[name]));
|
|
frame.name = name;
|
|
return frame;
|
|
});
|
|
}
|