UNPKG

1.64 kBTypeScriptView Raw
1import { Sheet2JSONOpts, ParsingOptions, Range, ColInfo, RowInfo, ProtectInfo, AutoFilterInfo, AOA2SheetOpts, WritingOptions } from 'xlsx';
2
3declare const parse: <T = any[]>(mixed: unknown, options?: Sheet2JSONOpts & ParsingOptions) => {
4 name: string;
5 data: T[];
6}[];
7declare const parseMetadata: (mixed: unknown, options?: ParsingOptions) => {
8 name: string;
9 data: Range | null;
10}[];
11type WorkSheetOptions = {
12 /** Column Info */
13 "!cols"?: ColInfo[];
14 /** Row Info */
15 "!rows"?: RowInfo[];
16 /** Merge Ranges */
17 "!merges"?: Range[];
18 /** Worksheet Protection info */
19 "!protect"?: ProtectInfo;
20 /** AutoFilter info */
21 "!autofilter"?: AutoFilterInfo;
22};
23type WorkSheet<T = unknown> = {
24 name: string;
25 data: T[][];
26 options: WorkSheetOptions;
27};
28type BuildOptions = WorkSheetOptions & {
29 parseOptions?: AOA2SheetOpts;
30 writeOptions?: WritingOptions;
31 sheetOptions?: WorkSheetOptions;
32};
33declare const build: (worksheets: WorkSheet[], { parseOptions, writeOptions, sheetOptions, ...otherOptions }?: BuildOptions) => Buffer;
34declare const _default: {
35 parse: <T = any[]>(mixed: unknown, options?: Sheet2JSONOpts & ParsingOptions) => {
36 name: string;
37 data: T[];
38 }[];
39 parseMetadata: (mixed: unknown, options?: ParsingOptions) => {
40 name: string;
41 data: Range | null;
42 }[];
43 build: (worksheets: WorkSheet<unknown>[], { parseOptions, writeOptions, sheetOptions, ...otherOptions }?: BuildOptions) => Buffer;
44};
45
46export { type BuildOptions, type WorkSheet, type WorkSheetOptions, build, _default as default, parse, parseMetadata };