MCPcopy
hub / github.com/mgcrea/node-xlsx / parse

Function parse

src/index.ts:21–41  ·  view source on GitHub ↗
(mixed: unknown, options: Sheet2JSONOpts & ParsingOptions = {})

Source from the content-addressed store, hash-verified

19
20// eslint-disable-next-line @typescript-eslint/no-explicit-any
21export const parse = <T = any[]>(mixed: unknown, options: Sheet2JSONOpts & ParsingOptions = {}) => {
22 const { dateNF, header = 1, range, blankrows, defval, raw = true, rawNumbers, ...otherOptions } = options;
23 const workBook = isString(mixed)
24 ? readFile(mixed, { dateNF, raw, ...otherOptions })
25 : read(mixed, { dateNF, raw, ...otherOptions });
26 return Object.keys(workBook.Sheets).map((name) => {
27 const sheet = workBook.Sheets[name]!;
28 return {
29 name,
30 data: utils.sheet_to_json<T>(sheet, {
31 dateNF,
32 header,
33 range: typeof range === "function" ? range(sheet) : range,
34 blankrows,
35 defval,
36 raw,
37 rawNumbers,
38 }),
39 };
40 });
41};
42
43export const parseMetadata = (mixed: unknown, options: ParsingOptions = {}) => {
44 const workBook = isString(mixed) ? readFile(mixed, options) : read(mixed, options);

Callers

nothing calls this directly

Calls 1

isStringFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…