2017-05-15 15:48:44 +00:00
|
|
|
/* index.d.ts (C) 2015-present SheetJS and contributors */
|
2017-05-13 23:31:56 +00:00
|
|
|
// TypeScript Version: 2.2
|
2022-02-12 06:31:47 +00:00
|
|
|
// import * as CFB from "cfb";
|
|
|
|
// import * as SSF from "ssf";
|
2015-06-03 13:34:42 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Version string */
|
|
|
|
export const version: string;
|
|
|
|
|
2017-07-05 22:27:54 +00:00
|
|
|
/** SSF Formatter Library */
|
2022-02-12 06:31:47 +00:00
|
|
|
// export { SSF };
|
|
|
|
export const SSF: any;
|
2017-07-05 10:24:46 +00:00
|
|
|
|
2017-12-04 04:41:41 +00:00
|
|
|
/** CFB Library */
|
2022-02-12 06:31:47 +00:00
|
|
|
// export { CFB };
|
|
|
|
export const CFB: any;
|
|
|
|
|
2023-04-10 05:15:44 +00:00
|
|
|
/** Set internal `fs` instance */
|
2022-02-12 06:31:47 +00:00
|
|
|
export function set_fs(fs: any): void;
|
2023-04-10 05:15:44 +00:00
|
|
|
/** Set internal codepage tables */
|
2022-02-12 06:31:47 +00:00
|
|
|
export function set_cptable(cptable: any): void;
|
2017-12-04 04:41:41 +00:00
|
|
|
|
2018-02-03 20:46:32 +00:00
|
|
|
/** NODE ONLY! Attempts to read filename and parse */
|
2017-05-13 23:37:23 +00:00
|
|
|
export function readFile(filename: string, opts?: ParsingOptions): WorkBook;
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Attempts to parse data */
|
2017-05-13 23:37:23 +00:00
|
|
|
export function read(data: any, opts?: ParsingOptions): WorkBook;
|
2018-02-03 20:46:32 +00:00
|
|
|
/** Attempts to write or download workbook data to file */
|
2024-04-27 23:49:12 +00:00
|
|
|
export function writeFile(data: WorkBook, filename: string, opts?: WritingOptions): void;
|
2022-02-14 01:28:13 +00:00
|
|
|
/** Attempts to write or download workbook data to XLSX file */
|
2024-04-27 23:49:12 +00:00
|
|
|
export function writeFileXLSX(data: WorkBook, filename: string, opts?: WritingOptions): void;
|
2021-09-21 01:09:24 +00:00
|
|
|
/** Attempts to write or download workbook data to file asynchronously */
|
|
|
|
type CBFunc = () => void;
|
2024-04-27 23:49:12 +00:00
|
|
|
export function writeFileAsync(filename: string, data: WorkBook, opts: WritingOptions | CBFunc, cb?: CBFunc): void;
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Attempts to write the workbook data */
|
2022-02-08 09:50:51 +00:00
|
|
|
export function write(data: WorkBook, opts: WritingOptions): any;
|
2022-02-14 01:28:13 +00:00
|
|
|
/** Attempts to write the workbook data as XLSX */
|
|
|
|
export function writeXLSX(data: WorkBook, opts: WritingOptions): any;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Utility Functions */
|
2017-06-10 01:47:42 +00:00
|
|
|
export const utils: XLSX$Utils;
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Stream Utility Functions */
|
2017-05-16 17:45:35 +00:00
|
|
|
export const stream: StreamUtils;
|
|
|
|
|
|
|
|
/** Number Format (either a string or an index to the format table) */
|
|
|
|
export type NumberFormat = string | number;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2020-01-28 01:20:38 +00:00
|
|
|
/** Worksheet specifier (string, number, worksheet) */
|
|
|
|
export type WSSpec = string | number | WorkSheet;
|
|
|
|
|
|
|
|
/** Range specifier (string or range or cell), single-cell lifted to range */
|
|
|
|
export type RangeSpec = string | Range | CellAddress;
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Basic File Properties */
|
2017-05-13 23:37:23 +00:00
|
|
|
export interface Properties {
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Summary tab "Title" */
|
2017-05-15 15:48:44 +00:00
|
|
|
Title?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Summary tab "Subject" */
|
2017-05-15 15:48:44 +00:00
|
|
|
Subject?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Summary tab "Author" */
|
2016-04-22 21:12:45 +00:00
|
|
|
Author?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Summary tab "Manager" */
|
2017-05-15 15:48:44 +00:00
|
|
|
Manager?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Summary tab "Company" */
|
2017-05-15 15:48:44 +00:00
|
|
|
Company?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Summary tab "Category" */
|
2017-05-15 15:48:44 +00:00
|
|
|
Category?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Summary tab "Keywords" */
|
2017-05-15 15:48:44 +00:00
|
|
|
Keywords?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Summary tab "Comments" */
|
2017-05-15 15:48:44 +00:00
|
|
|
Comments?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Statistics tab "Last saved by" */
|
2017-05-15 15:48:44 +00:00
|
|
|
LastAuthor?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Statistics tab "Created" */
|
2016-04-22 21:12:45 +00:00
|
|
|
CreatedDate?: Date;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Other supported properties */
|
|
|
|
export interface FullProperties extends Properties {
|
2017-05-12 21:46:46 +00:00
|
|
|
ModifiedDate?: Date;
|
2016-04-22 21:12:45 +00:00
|
|
|
Application?: string;
|
|
|
|
AppVersion?: string;
|
|
|
|
DocSecurity?: string;
|
|
|
|
HyperlinksChanged?: boolean;
|
|
|
|
SharedDoc?: boolean;
|
|
|
|
LinksUpToDate?: boolean;
|
|
|
|
ScaleCrop?: boolean;
|
|
|
|
Worksheets?: number;
|
|
|
|
SheetNames?: string[];
|
2017-05-16 17:45:35 +00:00
|
|
|
ContentStatus?: string;
|
|
|
|
LastPrinted?: string;
|
|
|
|
Revision?: string | number;
|
|
|
|
Version?: string;
|
|
|
|
Identifier?: string;
|
|
|
|
Language?: string;
|
2016-04-22 21:12:45 +00:00
|
|
|
}
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
export interface CommonOptions {
|
2017-03-12 07:21:11 +00:00
|
|
|
/**
|
2017-05-16 17:45:35 +00:00
|
|
|
* If true, throw errors when features are not understood
|
|
|
|
* @default false
|
2017-03-12 07:21:11 +00:00
|
|
|
*/
|
2017-05-16 17:45:35 +00:00
|
|
|
WTF?: boolean;
|
|
|
|
|
2017-12-04 04:41:41 +00:00
|
|
|
/**
|
|
|
|
* When reading a file with VBA macros, expose CFB blob to `vbaraw` field
|
|
|
|
* When writing BIFF8/XLSB/XLSM, reseat `vbaraw` and export to file
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
bookVBA?: boolean;
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/**
|
|
|
|
* When reading a file, store dates as type d (default is n)
|
|
|
|
* When writing XLSX/XLSM file, use native date (default uses date codes)
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
cellDates?: boolean;
|
2017-12-04 04:41:41 +00:00
|
|
|
|
2020-01-28 01:20:38 +00:00
|
|
|
/**
|
|
|
|
* Create cell objects for stub cells
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
sheetStubs?: boolean;
|
|
|
|
|
2017-12-04 04:41:41 +00:00
|
|
|
/**
|
|
|
|
* When reading a file, save style/theme info to the .s field
|
|
|
|
* When writing a file, export style/theme info
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
cellStyles?: boolean;
|
2020-01-28 01:20:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If defined and file is encrypted, use password
|
|
|
|
* @default ''
|
|
|
|
*/
|
|
|
|
password?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 22:38:23 +00:00
|
|
|
export interface DateNFOption {
|
|
|
|
/** Use specified date format */
|
|
|
|
dateNF?: NumberFormat;
|
|
|
|
}
|
|
|
|
|
2023-06-23 09:48:47 +00:00
|
|
|
export interface UTCOption {
|
|
|
|
/**
|
|
|
|
* For plaintext formats, interpret ambiguous datetimes in UTC
|
|
|
|
* If explicitly set to `false`, dates will be parsed in local time.
|
|
|
|
*
|
|
|
|
* The `true` option is consistent with spreadsheet application export.
|
|
|
|
*
|
|
|
|
* @default true
|
|
|
|
*/
|
|
|
|
UTC?: boolean;
|
|
|
|
}
|
|
|
|
|
2023-09-21 08:12:13 +00:00
|
|
|
export interface DenseOption {
|
|
|
|
/** If true, generate dense-mode worksheets */
|
|
|
|
dense?: boolean;
|
|
|
|
}
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Options for read and readFile */
|
2023-09-21 08:12:13 +00:00
|
|
|
export interface ParsingOptions extends UTCOption, CommonOptions, DenseOption {
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Input data encoding */
|
2018-03-07 13:49:25 +00:00
|
|
|
type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
|
2017-03-12 07:21:11 +00:00
|
|
|
|
2022-09-09 20:59:22 +00:00
|
|
|
/**
|
|
|
|
* Default codepage for legacy files
|
|
|
|
*
|
|
|
|
* This requires encoding support to be loaded. It is automatically loaded
|
|
|
|
* in `xlsx.full.min.js` and in CommonJS / Extendscript, but an extra step
|
|
|
|
* is required in React / Angular / Webpack ESM deployments.
|
|
|
|
*
|
|
|
|
* Check the relevant guide https://docs.sheetjs.com/docs/getting-started/
|
|
|
|
*/
|
2017-12-30 05:40:35 +00:00
|
|
|
codepage?: number;
|
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/**
|
|
|
|
* Save formulae to the .f field
|
|
|
|
* @default true
|
|
|
|
*/
|
2016-04-22 21:12:45 +00:00
|
|
|
cellFormula?: boolean;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse rich text and save HTML to the .h field
|
|
|
|
* @default true
|
|
|
|
*/
|
2016-04-22 21:12:45 +00:00
|
|
|
cellHTML?: boolean;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save number format string to the .z field
|
|
|
|
* @default false
|
|
|
|
*/
|
2016-04-22 21:12:45 +00:00
|
|
|
cellNF?: boolean;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
2017-05-16 17:45:35 +00:00
|
|
|
* Generate formatted text to the .w field
|
|
|
|
* @default true
|
2017-03-12 07:21:11 +00:00
|
|
|
*/
|
2017-05-16 17:45:35 +00:00
|
|
|
cellText?: boolean;
|
|
|
|
|
|
|
|
/** Override default date format (code 14) */
|
|
|
|
dateNF?: string;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
2021-11-09 00:31:56 +00:00
|
|
|
/** Field Separator ("Delimiter" override) */
|
|
|
|
FS?: string;
|
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/**
|
|
|
|
* If >0, read the first sheetRows rows
|
|
|
|
* @default 0
|
|
|
|
*/
|
2016-04-22 21:12:45 +00:00
|
|
|
sheetRows?: number;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, parse calculation chains
|
|
|
|
* @default false
|
|
|
|
*/
|
2016-04-22 21:12:45 +00:00
|
|
|
bookDeps?: boolean;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, add raw files to book object
|
|
|
|
* @default false
|
|
|
|
*/
|
2016-04-22 21:12:45 +00:00
|
|
|
bookFiles?: boolean;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, only parse enough to get book metadata
|
|
|
|
* @default false
|
|
|
|
*/
|
2016-04-22 21:12:45 +00:00
|
|
|
bookProps?: boolean;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, only parse enough to get the sheet names
|
|
|
|
* @default false
|
|
|
|
*/
|
2016-04-22 21:12:45 +00:00
|
|
|
bookSheets?: boolean;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
2020-01-28 01:20:38 +00:00
|
|
|
/** If specified, only parse the specified sheets or sheet names */
|
|
|
|
sheets?: number | string | Array<number | string>;
|
2017-08-09 22:38:23 +00:00
|
|
|
|
2020-07-31 03:38:44 +00:00
|
|
|
/** If true, plaintext parsing will not parse values */
|
2017-08-09 22:38:23 +00:00
|
|
|
raw?: boolean;
|
2017-09-22 22:18:51 +00:00
|
|
|
|
2022-11-17 09:35:34 +00:00
|
|
|
/** If true, ignore "dimensions" records and guess range using every cell */
|
|
|
|
nodim?: boolean;
|
|
|
|
|
2022-02-13 09:35:34 +00:00
|
|
|
/** If true, preserve _xlfn. prefixes in formula function names */
|
|
|
|
xlfn?: boolean;
|
|
|
|
|
2023-04-18 03:39:28 +00:00
|
|
|
/**
|
|
|
|
* For single-sheet formats (including CSV), override the worksheet name
|
|
|
|
* @default "Sheet1"
|
|
|
|
*/
|
|
|
|
sheet?: string;
|
|
|
|
|
2022-02-13 09:35:34 +00:00
|
|
|
PRN?: boolean;
|
2017-03-12 07:21:11 +00:00
|
|
|
}
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2022-01-18 18:05:40 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Options for write and writeFile */
|
2023-04-18 03:39:28 +00:00
|
|
|
export interface WritingOptions extends CommonOptions {
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Output data encoding */
|
2018-03-07 13:49:25 +00:00
|
|
|
type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate Shared String Table
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
bookSST?: boolean;
|
|
|
|
|
|
|
|
/**
|
2017-05-16 17:45:35 +00:00
|
|
|
* File format of generated workbook
|
2017-03-12 07:21:11 +00:00
|
|
|
* @default 'xlsx'
|
|
|
|
*/
|
2017-05-16 17:45:35 +00:00
|
|
|
bookType?: BookType;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Use ZIP compression for ZIP-based formats
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
compression?: boolean;
|
2017-05-16 17:45:35 +00:00
|
|
|
|
2024-04-27 23:49:12 +00:00
|
|
|
/** Override theme XML when exporting to XLSX/XLSM/XLSB */
|
2023-09-21 08:12:13 +00:00
|
|
|
themeXLSX?: string;
|
|
|
|
|
2018-08-15 19:22:47 +00:00
|
|
|
/**
|
|
|
|
* Suppress "number stored as text" errors in generated files
|
|
|
|
* @default true
|
|
|
|
*/
|
|
|
|
ignoreEC?: boolean;
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Override workbook properties on save */
|
|
|
|
Props?: Properties;
|
2022-03-24 13:59:49 +00:00
|
|
|
|
2022-09-09 20:59:22 +00:00
|
|
|
/**
|
|
|
|
* Desired codepage for legacy file formats
|
|
|
|
*
|
|
|
|
* This requires encoding support to be loaded. It is automatically loaded
|
|
|
|
* in `xlsx.full.min.js` and in CommonJS / Extendscript, but an extra step
|
|
|
|
* is required in React / Angular / Webpack / ESM deployments.
|
|
|
|
*
|
|
|
|
* Check the relevant guide https://docs.sheetjs.com/docs/getting-started/
|
|
|
|
*/
|
|
|
|
codepage?: number;
|
|
|
|
|
2022-03-24 13:59:49 +00:00
|
|
|
/** Base64 encoding of NUMBERS base for exports */
|
|
|
|
numbers?: string;
|
2023-04-18 03:39:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* For single-sheet formats, export the specified worksheet.
|
|
|
|
*
|
|
|
|
* The property must be a string (sheet name) or number (`SheetNames` index).
|
|
|
|
*
|
|
|
|
* If this option is omitted, the first worksheet will be exported.
|
|
|
|
*/
|
|
|
|
sheet?: string | number;
|
2023-06-23 09:48:47 +00:00
|
|
|
|
|
|
|
/** Field Separator ("delimiter") for CSV / Text output */
|
|
|
|
FS?: string;
|
|
|
|
|
|
|
|
/** Record Separator ("row separator") for CSV / Text output */
|
|
|
|
RS?: string;
|
2016-04-22 21:12:45 +00:00
|
|
|
}
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Workbook Object */
|
2017-05-13 23:37:23 +00:00
|
|
|
export interface WorkBook {
|
2016-04-22 21:12:45 +00:00
|
|
|
/**
|
|
|
|
* A dictionary of the worksheets in the workbook.
|
|
|
|
* Use SheetNames to reference these.
|
|
|
|
*/
|
2017-05-13 23:37:23 +00:00
|
|
|
Sheets: { [sheet: string]: WorkSheet };
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Ordered list of the sheet names in the workbook */
|
2016-04-22 21:12:45 +00:00
|
|
|
SheetNames: string[];
|
|
|
|
|
2018-05-05 06:34:37 +00:00
|
|
|
/** Standard workbook Properties */
|
2017-05-16 17:45:35 +00:00
|
|
|
Props?: FullProperties;
|
2017-05-15 15:48:44 +00:00
|
|
|
|
2018-05-05 06:34:37 +00:00
|
|
|
/** Custom workbook Properties */
|
2022-02-08 09:50:51 +00:00
|
|
|
Custprops?: object;
|
2018-05-05 06:34:37 +00:00
|
|
|
|
2017-05-15 15:48:44 +00:00
|
|
|
Workbook?: WBProps;
|
2017-12-04 04:41:41 +00:00
|
|
|
|
|
|
|
vbaraw?: any;
|
2022-07-08 22:31:08 +00:00
|
|
|
|
|
|
|
/** Original file type (when parsed with `read` or `readFile`) */
|
|
|
|
bookType?: BookType;
|
2017-05-15 15:48:44 +00:00
|
|
|
}
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
export interface SheetProps {
|
2020-06-26 19:51:23 +00:00
|
|
|
/** Name of Sheet */
|
2020-06-29 08:07:23 +00:00
|
|
|
name?: string;
|
2020-06-26 19:51:23 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Sheet Visibility (0=Visible 1=Hidden 2=VeryHidden) */
|
|
|
|
Hidden?: 0 | 1 | 2;
|
2017-11-20 01:51:14 +00:00
|
|
|
|
|
|
|
/** Name of Document Module in associated VBA Project */
|
|
|
|
CodeName?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Defined Name Object */
|
2017-05-16 17:45:35 +00:00
|
|
|
export interface DefinedName {
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Name */
|
2017-05-16 17:45:35 +00:00
|
|
|
Name: string;
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Reference */
|
2017-05-16 17:45:35 +00:00
|
|
|
Ref: string;
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Scope (undefined for workbook scope) */
|
2017-05-16 17:45:35 +00:00
|
|
|
Sheet?: number;
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Name comment */
|
2017-05-16 17:45:35 +00:00
|
|
|
Comment?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Workbook-Level Attributes */
|
2017-05-15 15:48:44 +00:00
|
|
|
export interface WBProps {
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Sheet Properties */
|
|
|
|
Sheets?: SheetProps[];
|
|
|
|
|
|
|
|
/** Defined Names */
|
|
|
|
Names?: DefinedName[];
|
2017-06-01 21:22:11 +00:00
|
|
|
|
2017-12-25 02:25:03 +00:00
|
|
|
/** Workbook Views */
|
2017-12-30 05:40:35 +00:00
|
|
|
Views?: WBView[];
|
2017-12-25 02:25:03 +00:00
|
|
|
|
2017-06-01 21:22:11 +00:00
|
|
|
/** Other Workbook Properties */
|
|
|
|
WBProps?: WorkbookProperties;
|
|
|
|
}
|
|
|
|
|
2017-12-30 05:40:35 +00:00
|
|
|
/** Workbook View */
|
|
|
|
export interface WBView {
|
|
|
|
/** Right-to-left mode */
|
|
|
|
RTL?: boolean;
|
|
|
|
}
|
|
|
|
|
2017-06-01 21:22:11 +00:00
|
|
|
/** Other Workbook Properties */
|
|
|
|
export interface WorkbookProperties {
|
|
|
|
/** Worksheet Epoch (1904 if true, 1900 if false) */
|
|
|
|
date1904?: boolean;
|
2017-06-03 07:19:09 +00:00
|
|
|
|
|
|
|
/** Warn or strip personally identifying info on save */
|
|
|
|
filterPrivacy?: boolean;
|
2017-11-20 01:51:14 +00:00
|
|
|
|
|
|
|
/** Name of Document Module in associated VBA Project */
|
|
|
|
CodeName?: string;
|
2016-04-22 21:12:45 +00:00
|
|
|
}
|
|
|
|
|
2022-03-10 05:31:13 +00:00
|
|
|
/** DBF Field Header */
|
|
|
|
export interface DBFField {
|
|
|
|
/** Original Field Name */
|
|
|
|
name?: string;
|
|
|
|
|
|
|
|
/** Field Type */
|
|
|
|
type?: string;
|
|
|
|
|
|
|
|
/** Field Length */
|
|
|
|
len?: number;
|
|
|
|
|
|
|
|
/** Field Decimal Count */
|
|
|
|
dec?: number;
|
|
|
|
}
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Column Properties Object */
|
2017-05-13 23:37:23 +00:00
|
|
|
export interface ColInfo {
|
2017-05-16 17:45:35 +00:00
|
|
|
/* --- visibility --- */
|
|
|
|
|
|
|
|
/** if true, the column is hidden */
|
|
|
|
hidden?: boolean;
|
|
|
|
|
|
|
|
/* --- column width --- */
|
|
|
|
|
|
|
|
/** width in Excel's "Max Digit Width", width*256 is integral */
|
2017-05-15 15:48:44 +00:00
|
|
|
width?: number;
|
2017-05-16 17:45:35 +00:00
|
|
|
|
|
|
|
/** width in screen pixels */
|
2017-05-12 21:46:24 +00:00
|
|
|
wpx?: number;
|
2017-05-16 17:45:35 +00:00
|
|
|
|
|
|
|
/** width in "characters" */
|
2017-05-12 21:46:24 +00:00
|
|
|
wch?: number;
|
2017-05-16 17:45:35 +00:00
|
|
|
|
2021-09-22 06:45:08 +00:00
|
|
|
/** outline / group level */
|
|
|
|
level?: number;
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Excel's "Max Digit Width" unit, always integral */
|
|
|
|
MDW?: number;
|
2022-03-10 05:31:13 +00:00
|
|
|
|
|
|
|
/** DBF Field Header */
|
|
|
|
DBF?: DBFField;
|
2017-05-12 21:46:24 +00:00
|
|
|
}
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Row Properties Object */
|
2017-05-13 23:37:23 +00:00
|
|
|
export interface RowInfo {
|
2017-05-16 17:45:35 +00:00
|
|
|
/* --- visibility --- */
|
|
|
|
|
|
|
|
/** if true, the column is hidden */
|
|
|
|
hidden?: boolean;
|
|
|
|
|
|
|
|
/* --- row height --- */
|
|
|
|
|
|
|
|
/** height in screen pixels */
|
2017-05-12 21:46:24 +00:00
|
|
|
hpx?: number;
|
2017-05-16 17:45:35 +00:00
|
|
|
|
|
|
|
/** height in points */
|
2017-05-12 21:46:24 +00:00
|
|
|
hpt?: number;
|
2017-09-22 22:18:51 +00:00
|
|
|
|
|
|
|
/** outline / group level */
|
|
|
|
level?: number;
|
2017-05-12 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write sheet protection properties.
|
|
|
|
*/
|
2017-05-13 23:37:23 +00:00
|
|
|
export interface ProtectInfo {
|
2017-05-12 21:46:24 +00:00
|
|
|
/**
|
|
|
|
* The password for formats that support password-protected sheets
|
|
|
|
* (XLSX/XLSB/XLS). The writer uses the XOR obfuscation method.
|
|
|
|
*/
|
|
|
|
password?: string;
|
|
|
|
/**
|
|
|
|
* Select locked cells
|
|
|
|
* @default: true
|
|
|
|
*/
|
|
|
|
selectLockedCells?: boolean;
|
|
|
|
/**
|
|
|
|
* Select unlocked cells
|
|
|
|
* @default: true
|
|
|
|
*/
|
|
|
|
selectUnlockedCells?: boolean;
|
|
|
|
/**
|
|
|
|
* Format cells
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
formatCells?: boolean;
|
|
|
|
/**
|
|
|
|
* Format columns
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
formatColumns?: boolean;
|
|
|
|
/**
|
|
|
|
* Format rows
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
formatRows?: boolean;
|
|
|
|
/**
|
|
|
|
* Insert columns
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
insertColumns?: boolean;
|
|
|
|
/**
|
|
|
|
* Insert rows
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
insertRows?: boolean;
|
|
|
|
/**
|
|
|
|
* Insert hyperlinks
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
insertHyperlinks?: boolean;
|
|
|
|
/**
|
|
|
|
* Delete columns
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
deleteColumns?: boolean;
|
|
|
|
/**
|
|
|
|
* Delete rows
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
deleteRows?: boolean;
|
|
|
|
/**
|
|
|
|
* Sort
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
sort?: boolean;
|
|
|
|
/**
|
|
|
|
* Filter
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
autoFilter?: boolean;
|
|
|
|
/**
|
|
|
|
* Use PivotTable reports
|
|
|
|
* @default: false
|
|
|
|
*/
|
|
|
|
pivotTables?: boolean;
|
|
|
|
/**
|
|
|
|
* Edit objects
|
|
|
|
* @default: true
|
|
|
|
*/
|
|
|
|
objects?: boolean;
|
|
|
|
/**
|
|
|
|
* Edit scenarios
|
|
|
|
* @default: true
|
|
|
|
*/
|
|
|
|
scenarios?: boolean;
|
|
|
|
}
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Page Margins -- see Excel Page Setup .. Margins diagram for explanation */
|
|
|
|
export interface MarginInfo {
|
|
|
|
/** Left side margin (inches) */
|
|
|
|
left?: number;
|
|
|
|
/** Right side margin (inches) */
|
|
|
|
right?: number;
|
|
|
|
/** Top side margin (inches) */
|
|
|
|
top?: number;
|
|
|
|
/** Bottom side margin (inches) */
|
|
|
|
bottom?: number;
|
|
|
|
/** Header top margin (inches) */
|
|
|
|
header?: number;
|
|
|
|
/** Footer bottom height (inches) */
|
|
|
|
footer?: number;
|
|
|
|
}
|
|
|
|
export type SheetType = 'sheet' | 'chart';
|
|
|
|
export type SheetKeys = string | MarginInfo | SheetType;
|
|
|
|
/** General object representing a Sheet (worksheet or chartsheet) */
|
2017-05-13 23:37:23 +00:00
|
|
|
export interface Sheet {
|
2017-05-16 17:45:35 +00:00
|
|
|
/**
|
2022-10-24 01:05:59 +00:00
|
|
|
* Sparse-mode store cells with keys corresponding to A1-style address
|
|
|
|
* Dense-mode store cells in the '!data' key
|
2017-05-16 17:45:35 +00:00
|
|
|
* Special keys start with '!'
|
|
|
|
*/
|
2022-10-24 01:05:59 +00:00
|
|
|
[cell: string]: CellObject | CellObject[][] | SheetKeys | any;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dense-mode worksheets store data in an array of arrays
|
|
|
|
*
|
|
|
|
* Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
|
|
|
|
*/
|
|
|
|
'!data'?: CellObject[][];
|
2017-05-16 17:45:35 +00:00
|
|
|
|
|
|
|
/** Sheet type */
|
|
|
|
'!type'?: SheetType;
|
|
|
|
|
2022-10-24 01:05:59 +00:00
|
|
|
/** Sheet Range (A1-style) */
|
2017-05-12 21:46:24 +00:00
|
|
|
'!ref'?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
|
|
|
|
/** Page Margins */
|
|
|
|
'!margins'?: MarginInfo;
|
|
|
|
}
|
2022-10-24 01:05:59 +00:00
|
|
|
/** General object representing a dense Sheet (worksheet or chartsheet) */
|
|
|
|
export interface DenseSheet extends Sheet {
|
|
|
|
/**
|
|
|
|
* Special keys start with '!'
|
|
|
|
* Dense-mode worksheets store data in the '!data' key
|
|
|
|
*/
|
2022-11-16 19:03:42 +00:00
|
|
|
[cell: string]: CellObject[][] | SheetKeys | any;
|
2022-10-24 01:05:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dense-mode worksheets store data in an array of arrays
|
|
|
|
*
|
|
|
|
* Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
|
|
|
|
*/
|
|
|
|
'!data': CellObject[][];
|
|
|
|
}
|
|
|
|
/** General object representing a sparse Sheet (worksheet or chartsheet) */
|
|
|
|
export interface SparseSheet extends Sheet {
|
|
|
|
/**
|
|
|
|
* Sparse-mode store cells with keys corresponding to A1-style address
|
|
|
|
* Cells are accessed with sheet[addr]
|
|
|
|
*/
|
|
|
|
'!data': never;
|
|
|
|
}
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
|
|
|
|
/** AutoFilter properties */
|
|
|
|
export interface AutoFilterInfo {
|
|
|
|
/** Range of the AutoFilter table */
|
|
|
|
ref: string;
|
2017-05-12 21:46:24 +00:00
|
|
|
}
|
2020-01-28 01:20:38 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
export type WSKeys = SheetKeys | ColInfo[] | RowInfo[] | Range[] | ProtectInfo | AutoFilterInfo;
|
2017-05-12 21:46:24 +00:00
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Worksheet Object */
|
2017-05-13 23:37:23 +00:00
|
|
|
export interface WorkSheet extends Sheet {
|
2017-05-16 17:45:35 +00:00
|
|
|
/**
|
|
|
|
* Indexing with a cell address string maps to a cell object
|
|
|
|
* Special keys start with '!'
|
|
|
|
*/
|
|
|
|
[cell: string]: CellObject | WSKeys | any;
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Column Info */
|
2017-05-13 23:37:23 +00:00
|
|
|
'!cols'?: ColInfo[];
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Row Info */
|
2017-05-13 23:37:23 +00:00
|
|
|
'!rows'?: RowInfo[];
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Merge Ranges */
|
2017-05-13 23:37:23 +00:00
|
|
|
'!merges'?: Range[];
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Worksheet Protection info */
|
2017-05-13 23:37:23 +00:00
|
|
|
'!protect'?: ProtectInfo;
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** AutoFilter info */
|
2017-05-16 17:45:35 +00:00
|
|
|
'!autofilter'?: AutoFilterInfo;
|
2016-04-22 21:12:45 +00:00
|
|
|
}
|
2022-10-24 01:05:59 +00:00
|
|
|
/** Dense Worksheet Object */
|
|
|
|
export interface DenseWorkSheet extends DenseSheet {
|
|
|
|
/**
|
|
|
|
* Dense-mode worksheets store data in an array of arrays
|
|
|
|
*
|
|
|
|
* Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
|
|
|
|
*/
|
|
|
|
'!data': CellObject[][];
|
|
|
|
}
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2020-01-28 01:20:38 +00:00
|
|
|
/**
|
|
|
|
* Worksheet Object with CellObject type
|
|
|
|
*
|
|
|
|
* The normal Worksheet type uses indexer of type `any` -- this enforces CellObject
|
|
|
|
*/
|
|
|
|
export interface StrictWS { [addr: string]: CellObject; }
|
|
|
|
|
2017-05-12 21:46:31 +00:00
|
|
|
/**
|
2017-05-12 21:46:39 +00:00
|
|
|
* The Excel data type for a cell.
|
2017-06-19 07:14:14 +00:00
|
|
|
* b Boolean, n Number, e error, s String, d Date, z Stub
|
2017-05-12 21:46:39 +00:00
|
|
|
*/
|
2017-05-15 15:48:44 +00:00
|
|
|
export type ExcelDataType = 'b' | 'n' | 'e' | 's' | 'd' | 'z';
|
2017-05-12 21:46:31 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/**
|
|
|
|
* Type of generated workbook
|
|
|
|
* @default 'xlsx'
|
|
|
|
*/
|
2022-04-11 04:11:47 +00:00
|
|
|
export type BookType = 'xlsx' | 'xlsm' | 'xlsb' | 'xls' | 'xla' | 'biff8' | 'biff5' | 'biff2' | 'xlml' | 'ods' | 'fods' | 'csv' | 'txt' | 'sylk' | 'slk' | 'html' | 'dif' | 'rtf' | 'prn' | 'eth' | 'dbf' | 'numbers';
|
2017-05-16 17:45:35 +00:00
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Comment element */
|
2017-05-16 17:45:35 +00:00
|
|
|
export interface Comment {
|
|
|
|
/** Author of the comment block */
|
|
|
|
a?: string;
|
|
|
|
|
|
|
|
/** Plaintext of the comment */
|
|
|
|
t: string;
|
2022-03-14 06:51:33 +00:00
|
|
|
|
|
|
|
/** If true, mark the comment as a part of a thread */
|
|
|
|
T?: boolean;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|
|
|
|
|
2020-01-28 01:20:38 +00:00
|
|
|
/** Cell comments */
|
|
|
|
export interface Comments extends Array<Comment> {
|
|
|
|
/** Hide comment by default */
|
|
|
|
hidden?: boolean;
|
|
|
|
}
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Link object */
|
2017-05-16 17:45:35 +00:00
|
|
|
export interface Hyperlink {
|
|
|
|
/** Target of the link (HREF) */
|
|
|
|
Target: string;
|
|
|
|
|
|
|
|
/** Plaintext tooltip to display when mouse is over cell */
|
|
|
|
Tooltip?: string;
|
|
|
|
}
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Worksheet Cell Object */
|
2017-05-15 15:48:44 +00:00
|
|
|
export interface CellObject {
|
2017-05-16 17:45:35 +00:00
|
|
|
/** The raw value of the cell. Can be omitted if a formula is specified */
|
|
|
|
v?: string | number | boolean | Date;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Formatted text (if applicable) */
|
2017-03-12 07:21:11 +00:00
|
|
|
w?: string;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
|
|
|
/**
|
2017-05-12 21:46:39 +00:00
|
|
|
* The Excel Data Type of the cell.
|
2017-05-16 17:45:35 +00:00
|
|
|
* b Boolean, n Number, e Error, s String, d Date, z Empty
|
2017-05-12 21:46:39 +00:00
|
|
|
*/
|
2017-05-12 21:46:31 +00:00
|
|
|
t: ExcelDataType;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Cell formula (if applicable) */
|
2017-03-12 07:21:11 +00:00
|
|
|
f?: string;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Range of enclosing array if formula is array formula (if applicable) */
|
2017-03-12 07:21:11 +00:00
|
|
|
F?: string;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2023-03-15 08:17:09 +00:00
|
|
|
/** If true, cell is a dynamic array formula (for supported file formats) */
|
|
|
|
D?: boolean;
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Rich text encoding (if applicable) */
|
|
|
|
r?: any;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** HTML rendering of the rich text (if applicable) */
|
2017-03-12 07:21:11 +00:00
|
|
|
h?: string;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Comments associated with the cell */
|
2020-01-28 01:20:38 +00:00
|
|
|
c?: Comments;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Number format string associated with the cell (if requested) */
|
|
|
|
z?: NumberFormat;
|
2016-04-22 21:12:45 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Cell hyperlink object (.Target holds link, .tooltip is tooltip) */
|
|
|
|
l?: Hyperlink;
|
2015-06-03 13:34:42 +00:00
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** The style/theme of the cell (if applicable) */
|
2017-07-27 16:06:55 +00:00
|
|
|
s?: any;
|
2016-04-22 21:12:45 +00:00
|
|
|
}
|
2015-06-03 13:34:42 +00:00
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Simple Cell Address */
|
2017-05-15 15:48:44 +00:00
|
|
|
export interface CellAddress {
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Column number */
|
2016-08-11 20:18:32 +00:00
|
|
|
c: number;
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Row number */
|
2016-08-11 20:18:32 +00:00
|
|
|
r: number;
|
|
|
|
}
|
|
|
|
|
2020-01-28 01:20:38 +00:00
|
|
|
/** Range object (representing ranges like "A1:B2") */
|
2017-05-13 23:37:23 +00:00
|
|
|
export interface Range {
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Starting cell */
|
2017-05-15 15:48:44 +00:00
|
|
|
s: CellAddress;
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Ending cell */
|
2017-05-15 15:48:44 +00:00
|
|
|
e: CellAddress;
|
2016-11-22 23:08:50 +00:00
|
|
|
}
|
|
|
|
|
2017-08-09 22:38:23 +00:00
|
|
|
export interface Sheet2CSVOpts extends DateNFOption {
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Field Separator ("delimiter") */
|
|
|
|
FS?: string;
|
|
|
|
|
|
|
|
/** Record Separator ("row separator") */
|
|
|
|
RS?: string;
|
|
|
|
|
2017-08-05 06:32:57 +00:00
|
|
|
/** Remove trailing field separators in each record */
|
|
|
|
strip?: boolean;
|
|
|
|
|
|
|
|
/** Include blank lines in the CSV output */
|
|
|
|
blankrows?: boolean;
|
|
|
|
|
|
|
|
/** Skip hidden rows and columns in the CSV output */
|
|
|
|
skipHidden?: boolean;
|
2020-06-18 01:34:04 +00:00
|
|
|
|
|
|
|
/** Force quotes around fields */
|
|
|
|
forceQuotes?: boolean;
|
2020-06-18 21:34:04 +00:00
|
|
|
|
|
|
|
/** if true, return raw numbers; if false, return formatted numbers */
|
|
|
|
rawNumbers?: boolean;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|
|
|
|
|
2018-01-09 07:36:02 +00:00
|
|
|
export interface OriginOption {
|
|
|
|
/** Top-Left cell for operation (CellAddress or A1 string or row) */
|
|
|
|
origin?: number | string | CellAddress;
|
|
|
|
}
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
export interface Sheet2HTMLOpts {
|
2018-02-03 20:46:32 +00:00
|
|
|
/** TABLE element id attribute */
|
|
|
|
id?: string;
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Add contenteditable to every cell */
|
2017-05-16 17:45:35 +00:00
|
|
|
editable?: boolean;
|
2017-08-05 06:32:57 +00:00
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Header HTML */
|
2017-05-16 17:45:35 +00:00
|
|
|
header?: string;
|
2017-08-05 06:32:57 +00:00
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Footer HTML */
|
2017-05-16 17:45:35 +00:00
|
|
|
footer?: string;
|
|
|
|
}
|
|
|
|
|
2017-08-09 22:38:23 +00:00
|
|
|
export interface Sheet2JSONOpts extends DateNFOption {
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Output format */
|
2017-05-16 17:45:35 +00:00
|
|
|
header?: "A"|number|string[];
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Override worksheet range */
|
2017-05-16 17:45:35 +00:00
|
|
|
range?: any;
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Include or omit blank lines in the output */
|
|
|
|
blankrows?: boolean;
|
|
|
|
|
|
|
|
/** Default value for null/undefined values */
|
|
|
|
defval?: any;
|
|
|
|
|
|
|
|
/** if true, return raw data; if false, return formatted text */
|
2017-05-16 17:45:35 +00:00
|
|
|
raw?: boolean;
|
2020-06-18 21:34:04 +00:00
|
|
|
|
2022-03-12 00:24:23 +00:00
|
|
|
/** if true, skip hidden rows and columns */
|
|
|
|
skipHidden?: boolean;
|
|
|
|
|
2020-06-18 21:34:04 +00:00
|
|
|
/** if true, return raw numbers; if false, return formatted numbers */
|
|
|
|
rawNumbers?: boolean;
|
2023-06-23 09:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, return dates whose UTC interpretation is correct
|
|
|
|
* By default, return dates whose local interpretation is correct
|
|
|
|
*
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
UTC?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface UTCDateOption {
|
|
|
|
/**
|
|
|
|
* If true, dates are interpreted using the UTC methods
|
|
|
|
* By default, dates are interpreted in the local timezone
|
|
|
|
*
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
UTC?: boolean;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|
|
|
|
|
2023-09-21 08:12:13 +00:00
|
|
|
export interface AOA2SheetOpts extends CommonOptions, UTCDateOption, DateNFOption, DenseOption {
|
2017-05-16 17:45:35 +00:00
|
|
|
/**
|
|
|
|
* Create cell objects for stub cells
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
sheetStubs?: boolean;
|
|
|
|
}
|
|
|
|
|
2018-01-09 07:36:02 +00:00
|
|
|
export interface SheetAOAOpts extends AOA2SheetOpts, OriginOption {}
|
|
|
|
|
2023-09-21 08:12:13 +00:00
|
|
|
export interface JSON2SheetOpts extends CommonOptions, UTCDateOption, DateNFOption, OriginOption, DenseOption {
|
2017-08-09 22:38:23 +00:00
|
|
|
/** Use specified column order */
|
|
|
|
header?: string[];
|
2018-01-09 07:36:02 +00:00
|
|
|
|
|
|
|
/** Skip header row in generated sheet */
|
|
|
|
skipHeader?: boolean;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|
|
|
|
|
2023-04-18 03:39:28 +00:00
|
|
|
export interface Table2SheetOpts extends CommonOptions, DateNFOption, OriginOption {
|
2020-07-31 03:38:44 +00:00
|
|
|
/** If true, plaintext parsing will not parse values */
|
2017-08-09 22:38:23 +00:00
|
|
|
raw?: boolean;
|
2018-04-06 06:39:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If >0, read the first sheetRows rows
|
|
|
|
* @default 0
|
|
|
|
*/
|
|
|
|
sheetRows?: number;
|
2018-05-27 07:27:47 +00:00
|
|
|
|
|
|
|
/** If true, hidden rows and cells will not be parsed */
|
|
|
|
display?: boolean;
|
2023-04-18 03:39:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Override the worksheet name
|
|
|
|
* @default "Sheet1"
|
|
|
|
*/
|
|
|
|
sheet?: string;
|
2023-06-23 09:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, interpret date strings as if they are UTC.
|
|
|
|
* By default, date strings are interpreted in the local timezone.
|
|
|
|
*
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
UTC?: boolean;
|
2023-04-18 03:39:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Table2BookOpts extends Table2SheetOpts {
|
|
|
|
/**
|
|
|
|
* Override the worksheet name
|
|
|
|
* @default "Sheet1"
|
|
|
|
*/
|
|
|
|
sheet?: string;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** General utilities */
|
2017-06-10 01:47:42 +00:00
|
|
|
export interface XLSX$Utils {
|
2017-05-16 17:45:35 +00:00
|
|
|
/* --- Import Functions --- */
|
|
|
|
|
|
|
|
/** Converts an array of arrays of JS data to a worksheet. */
|
|
|
|
aoa_to_sheet<T>(data: T[][], opts?: AOA2SheetOpts): WorkSheet;
|
|
|
|
aoa_to_sheet(data: any[][], opts?: AOA2SheetOpts): WorkSheet;
|
|
|
|
|
|
|
|
/** Converts an array of JS objects to a worksheet. */
|
|
|
|
json_to_sheet<T>(data: T[], opts?: JSON2SheetOpts): WorkSheet;
|
|
|
|
json_to_sheet(data: any[], opts?: JSON2SheetOpts): WorkSheet;
|
2017-05-15 15:48:44 +00:00
|
|
|
|
2017-07-10 22:18:18 +00:00
|
|
|
/** BROWSER ONLY! Converts a TABLE DOM element to a worksheet. */
|
|
|
|
table_to_sheet(data: any, opts?: Table2SheetOpts): WorkSheet;
|
2023-04-18 03:39:28 +00:00
|
|
|
table_to_book(data: any, opts?: Table2BookOpts): WorkBook;
|
2020-07-31 03:38:44 +00:00
|
|
|
sheet_add_dom(ws: WorkSheet, data: any, opts?: Table2SheetOpts): WorkSheet;
|
2017-05-16 17:45:35 +00:00
|
|
|
|
|
|
|
/* --- Export Functions --- */
|
2017-04-14 20:37:22 +00:00
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Converts a worksheet object to an array of JSON objects */
|
2017-05-16 17:45:35 +00:00
|
|
|
sheet_to_json<T>(worksheet: WorkSheet, opts?: Sheet2JSONOpts): T[];
|
|
|
|
sheet_to_json(worksheet: WorkSheet, opts?: Sheet2JSONOpts): any[][];
|
|
|
|
sheet_to_json(worksheet: WorkSheet, opts?: Sheet2JSONOpts): any[];
|
2017-05-15 15:48:44 +00:00
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Generates delimiter-separated-values output */
|
2017-05-16 17:45:35 +00:00
|
|
|
sheet_to_csv(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
|
|
|
|
|
2017-12-01 05:48:10 +00:00
|
|
|
/** Generates UTF16 Formatted Text */
|
|
|
|
sheet_to_txt(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
|
|
|
|
|
2017-05-16 17:45:35 +00:00
|
|
|
/** Generates HTML */
|
|
|
|
sheet_to_html(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
|
2017-05-15 15:48:44 +00:00
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Generates a list of the formulae (with value fallbacks) */
|
2017-05-16 17:45:35 +00:00
|
|
|
sheet_to_formulae(worksheet: WorkSheet): string[];
|
2017-03-12 07:21:11 +00:00
|
|
|
|
2017-05-15 15:48:44 +00:00
|
|
|
/* --- Cell Address Utilities --- */
|
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Converts 0-indexed cell address to A1 form */
|
2017-05-15 15:48:44 +00:00
|
|
|
encode_cell(cell: CellAddress): string;
|
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Converts 0-indexed row to A1 form */
|
|
|
|
encode_row(row: number): string;
|
2017-05-15 15:48:44 +00:00
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Converts 0-indexed column to A1 form */
|
|
|
|
encode_col(col: number): string;
|
2017-05-15 15:48:44 +00:00
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Converts 0-indexed range to A1 form */
|
2017-05-15 15:48:44 +00:00
|
|
|
encode_range(s: CellAddress, e: CellAddress): string;
|
2017-05-16 17:45:35 +00:00
|
|
|
encode_range(r: Range): string;
|
2017-03-12 07:21:11 +00:00
|
|
|
|
|
|
|
/** Converts A1 cell address to 0-indexed form */
|
2017-05-15 15:48:44 +00:00
|
|
|
decode_cell(address: string): CellAddress;
|
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Converts A1 row to 0-indexed form */
|
|
|
|
decode_row(row: string): number;
|
2017-05-15 15:48:44 +00:00
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Converts A1 column to 0-indexed form */
|
|
|
|
decode_col(col: string): number;
|
2017-05-15 15:48:44 +00:00
|
|
|
|
2017-03-12 07:21:11 +00:00
|
|
|
/** Converts A1 range to 0-indexed form */
|
2017-05-13 23:37:23 +00:00
|
|
|
decode_range(range: string): Range;
|
2017-06-17 20:45:03 +00:00
|
|
|
|
2018-03-13 02:51:54 +00:00
|
|
|
/** Format cell */
|
|
|
|
format_cell(cell: CellObject, v?: any, opts?: any): string;
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/* --- General Utilities --- */
|
2017-06-17 20:45:03 +00:00
|
|
|
|
2023-10-11 20:22:13 +00:00
|
|
|
/** Create a new workbook */
|
|
|
|
book_new(ws?: WorkSheet, wsname?: string): WorkBook;
|
|
|
|
|
|
|
|
/** Create a new worksheet */
|
|
|
|
sheet_new(opts?: DenseOption): WorkSheet;
|
2017-06-17 20:45:03 +00:00
|
|
|
|
2022-05-22 23:51:41 +00:00
|
|
|
/** Append a worksheet to a workbook, returns new worksheet name */
|
|
|
|
book_append_sheet(workbook: WorkBook, worksheet: WorkSheet, name?: string, roll?: boolean): string;
|
2017-06-19 07:14:14 +00:00
|
|
|
|
|
|
|
/** Set sheet visibility (visible/hidden/very hidden) */
|
|
|
|
book_set_sheet_visibility(workbook: WorkBook, sheet: number|string, visibility: number): void;
|
|
|
|
|
|
|
|
/** Set number format for a cell */
|
|
|
|
cell_set_number_format(cell: CellObject, fmt: string|number): CellObject;
|
|
|
|
|
|
|
|
/** Set hyperlink for a cell */
|
|
|
|
cell_set_hyperlink(cell: CellObject, target: string, tooltip?: string): CellObject;
|
|
|
|
|
2017-12-15 01:18:40 +00:00
|
|
|
/** Set internal link for a cell */
|
|
|
|
cell_set_internal_link(cell: CellObject, target: string, tooltip?: string): CellObject;
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
/** Add comment to a cell */
|
|
|
|
cell_add_comment(cell: CellObject, text: string, author?: string): void;
|
|
|
|
|
|
|
|
/** Assign an Array Formula to a range */
|
2022-03-03 08:35:39 +00:00
|
|
|
sheet_set_array_formula(ws: WorkSheet, range: Range|string, formula: string, dynamic?: boolean): WorkSheet;
|
2017-06-19 07:14:14 +00:00
|
|
|
|
2018-01-09 07:36:02 +00:00
|
|
|
/** Add an array of arrays of JS data to a worksheet */
|
|
|
|
sheet_add_aoa<T>(ws: WorkSheet, data: T[][], opts?: SheetAOAOpts): WorkSheet;
|
|
|
|
sheet_add_aoa(ws: WorkSheet, data: any[][], opts?: SheetAOAOpts): WorkSheet;
|
|
|
|
|
|
|
|
/** Add an array of JS objects to a worksheet */
|
2023-01-01 21:53:44 +00:00
|
|
|
sheet_add_json(ws: WorkSheet, data: any[], opts?: JSON2SheetOpts): WorkSheet;
|
|
|
|
sheet_add_json<T>(ws: WorkSheet, data: T[], opts?: JSON2SheetOpts): WorkSheet;
|
2018-01-09 07:36:02 +00:00
|
|
|
|
|
|
|
|
2017-06-19 07:14:14 +00:00
|
|
|
consts: XLSX$Consts;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface XLSX$Consts {
|
|
|
|
/* --- Sheet Visibility --- */
|
|
|
|
|
|
|
|
/** Visibility: Visible */
|
|
|
|
SHEET_VISIBLE: 0;
|
|
|
|
|
|
|
|
/** Visibility: Hidden */
|
|
|
|
SHEET_HIDDEN: 1;
|
|
|
|
|
|
|
|
/** Visibility: Very Hidden */
|
|
|
|
SHEET_VERYHIDDEN: 2;
|
2015-06-03 13:34:42 +00:00
|
|
|
}
|
2017-05-16 17:45:35 +00:00
|
|
|
|
|
|
|
/** NODE ONLY! these return Readable Streams */
|
|
|
|
export interface StreamUtils {
|
|
|
|
/** CSV output stream, generate one line at a time */
|
|
|
|
to_csv(sheet: WorkSheet, opts?: Sheet2CSVOpts): any;
|
|
|
|
/** HTML output stream, generate one line at a time */
|
|
|
|
to_html(sheet: WorkSheet, opts?: Sheet2HTMLOpts): any;
|
2018-07-09 03:46:11 +00:00
|
|
|
/** JSON object stream, generate one row at a time */
|
|
|
|
to_json(sheet: WorkSheet, opts?: Sheet2JSONOpts): any;
|
2022-03-09 01:44:10 +00:00
|
|
|
/** Set `Readable` (internal) */
|
|
|
|
set_readable(Readable: any): void;
|
2017-05-16 17:45:35 +00:00
|
|
|
}
|