sheetjs/types/index.d.ts

904 lines
23 KiB
TypeScript
Raw Permalink Normal View History

/* index.d.ts (C) 2015-present SheetJS and contributors */
// TypeScript Version: 2.2
2022-02-12 06:31:47 +00:00
// import * as CFB from "cfb";
// import * as SSF from "ssf";
/** Version string */
export const version: string;
/** 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
/** CFB Library */
2022-02-12 06:31:47 +00:00
// export { CFB };
export const CFB: any;
/** ESM ONLY! Set internal `fs` instance */
export function set_fs(fs: any): void;
/** ESM ONLY! Set internal codepage tables */
export function set_cptable(cptable: any): void;
/** 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;
/** Attempts to write or download workbook data to file */
2017-05-13 23:37:23 +00:00
export function writeFile(data: WorkBook, filename: string, opts?: WritingOptions): any;
2022-02-14 01:28:13 +00:00
/** Attempts to write or download workbook data to XLSX file */
export function writeFileXLSX(data: WorkBook, filename: string, opts?: WritingOptions): any;
2021-09-21 01:09:24 +00:00
/** Attempts to write or download workbook data to file asynchronously */
type CBFunc = () => void;
export function writeFileAsync(filename: string, data: WorkBook, opts: WritingOptions | CBFunc, cb?: CBFunc): any;
2017-03-12 07:21:11 +00:00
/** Attempts to write the workbook data */
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 */
export const utils: XLSX$Utils;
2017-06-19 07:14:14 +00:00
/** Stream Utility Functions */
export const stream: StreamUtils;
/** Number Format (either a string or an index to the format table) */
export type NumberFormat = string | number;
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;
/** Basic File Properties */
2017-05-13 23:37:23 +00:00
export interface Properties {
/** Summary tab "Title" */
Title?: string;
/** Summary tab "Subject" */
Subject?: string;
/** Summary tab "Author" */
Author?: string;
/** Summary tab "Manager" */
Manager?: string;
/** Summary tab "Company" */
Company?: string;
/** Summary tab "Category" */
Category?: string;
/** Summary tab "Keywords" */
Keywords?: string;
/** Summary tab "Comments" */
Comments?: string;
/** Statistics tab "Last saved by" */
LastAuthor?: string;
/** Statistics tab "Created" */
CreatedDate?: Date;
}
/** Other supported properties */
export interface FullProperties extends Properties {
2017-05-12 21:46:46 +00:00
ModifiedDate?: Date;
Application?: string;
AppVersion?: string;
DocSecurity?: string;
HyperlinksChanged?: boolean;
SharedDoc?: boolean;
LinksUpToDate?: boolean;
ScaleCrop?: boolean;
Worksheets?: number;
SheetNames?: string[];
ContentStatus?: string;
LastPrinted?: string;
Revision?: string | number;
Version?: string;
Identifier?: string;
Language?: string;
}
export interface CommonOptions {
2017-03-12 07:21:11 +00:00
/**
* If true, throw errors when features are not understood
* @default false
2017-03-12 07:21:11 +00:00
*/
WTF?: boolean;
/**
* 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;
/**
* 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;
2020-01-28 01:20:38 +00:00
/**
* Create cell objects for stub cells
* @default false
*/
sheetStubs?: boolean;
/**
* 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;
}
export interface DateNFOption {
/** Use specified date format */
dateNF?: NumberFormat;
}
/** Options for read and readFile */
export interface ParsingOptions extends CommonOptions {
/** Input data encoding */
type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
2017-03-12 07:21:11 +00:00
/** Default codepage */
codepage?: number;
2017-03-12 07:21:11 +00:00
/**
* Save formulae to the .f field
* @default true
*/
cellFormula?: boolean;
2017-03-12 07:21:11 +00:00
/**
* Parse rich text and save HTML to the .h field
* @default true
*/
cellHTML?: boolean;
2017-03-12 07:21:11 +00:00
/**
* Save number format string to the .z field
* @default false
*/
cellNF?: boolean;
2017-03-12 07:21:11 +00:00
/**
* Generate formatted text to the .w field
* @default true
2017-03-12 07:21:11 +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
*/
sheetRows?: number;
2017-03-12 07:21:11 +00:00
/**
* If true, parse calculation chains
* @default false
*/
bookDeps?: boolean;
2017-03-12 07:21:11 +00:00
/**
* If true, add raw files to book object
* @default false
*/
bookFiles?: boolean;
2017-03-12 07:21:11 +00:00
/**
* If true, only parse enough to get book metadata
* @default false
*/
bookProps?: boolean;
2017-03-12 07:21:11 +00:00
/**
* If true, only parse enough to get the sheet names
* @default false
*/
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>;
/** If true, plaintext parsing will not parse values */
raw?: boolean;
2022-02-13 09:35:34 +00:00
/** If true, preserve _xlfn. prefixes in formula function names */
xlfn?: boolean;
dense?: boolean;
2022-02-13 09:35:34 +00:00
PRN?: boolean;
2017-03-12 07:21:11 +00:00
}
export interface SheetOption {
/**
* Name of Worksheet (for single-sheet formats)
* @default ''
*/
sheet?: string;
}
/** Options for write and writeFile */
export interface WritingOptions extends CommonOptions, SheetOption {
/** Output data encoding */
type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
2017-03-12 07:21:11 +00:00
/**
* Generate Shared String Table
* @default false
*/
bookSST?: boolean;
/**
* File format of generated workbook
2017-03-12 07:21:11 +00:00
* @default 'xlsx'
*/
bookType?: BookType;
2017-03-12 07:21:11 +00:00
/**
* Use ZIP compression for ZIP-based formats
* @default false
*/
compression?: boolean;
/**
* Suppress "number stored as text" errors in generated files
* @default true
*/
ignoreEC?: boolean;
/** Override workbook properties on save */
Props?: Properties;
/** Base64 encoding of NUMBERS base for exports */
numbers?: string;
}
/** Workbook Object */
2017-05-13 23:37:23 +00:00
export interface WorkBook {
/**
* 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 };
/** Ordered list of the sheet names in the workbook */
SheetNames: string[];
/** Standard workbook Properties */
Props?: FullProperties;
/** Custom workbook Properties */
Custprops?: object;
Workbook?: WBProps;
vbaraw?: any;
2022-07-08 22:31:08 +00:00
/** Original file type (when parsed with `read` or `readFile`) */
bookType?: BookType;
}
export interface SheetProps {
2020-06-26 19:51:23 +00:00
/** Name of Sheet */
name?: string;
2020-06-26 19:51:23 +00:00
/** Sheet Visibility (0=Visible 1=Hidden 2=VeryHidden) */
Hidden?: 0 | 1 | 2;
/** Name of Document Module in associated VBA Project */
CodeName?: string;
}
2017-06-19 07:14:14 +00:00
/** Defined Name Object */
export interface DefinedName {
2017-06-19 07:14:14 +00:00
/** Name */
Name: string;
2017-06-19 07:14:14 +00:00
/** Reference */
Ref: string;
2017-06-19 07:14:14 +00:00
/** Scope (undefined for workbook scope) */
Sheet?: number;
2017-06-19 07:14:14 +00:00
/** Name comment */
Comment?: string;
}
/** Workbook-Level Attributes */
export interface WBProps {
/** Sheet Properties */
Sheets?: SheetProps[];
/** Defined Names */
Names?: DefinedName[];
/** Workbook Views */
Views?: WBView[];
/** Other Workbook Properties */
WBProps?: WorkbookProperties;
}
/** Workbook View */
export interface WBView {
/** Right-to-left mode */
RTL?: boolean;
}
/** 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;
/** Name of Document Module in associated VBA Project */
CodeName?: string;
}
/** 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 {
/* --- visibility --- */
/** if true, the column is hidden */
hidden?: boolean;
/* --- column width --- */
/** width in Excel's "Max Digit Width", width*256 is integral */
width?: number;
/** width in screen pixels */
2017-05-12 21:46:24 +00:00
wpx?: number;
/** width in "characters" */
2017-05-12 21:46:24 +00:00
wch?: number;
/** outline / group level */
level?: number;
/** Excel's "Max Digit Width" unit, always integral */
MDW?: number;
/** 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 {
/* --- 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;
/** height in points */
2017-05-12 21:46:24 +00:00
hpt?: number;
/** 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;
}
/** 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 {
/**
* Indexing with a cell address string maps to a cell object
* Special keys start with '!'
*/
[cell: string]: CellObject | SheetKeys | any;
/** Sheet type */
'!type'?: SheetType;
/** Sheet Range */
2017-05-12 21:46:24 +00:00
'!ref'?: string;
/** Page Margins */
'!margins'?: MarginInfo;
}
/** 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
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 {
/**
* 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 */
'!autofilter'?: AutoFilterInfo;
}
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: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
*/
export type ExcelDataType = 'b' | 'n' | 'e' | 's' | 'd' | 'z';
/**
* 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-06-19 07:14:14 +00:00
/** Comment element */
export interface Comment {
/** Author of the comment block */
a?: string;
/** Plaintext of the comment */
t: string;
/** If true, mark the comment as a part of a thread */
T?: boolean;
}
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 */
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 */
export interface CellObject {
/** The raw value of the cell. Can be omitted if a formula is specified */
v?: string | number | boolean | Date;
/** Formatted text (if applicable) */
2017-03-12 07:21:11 +00:00
w?: string;
/**
2017-05-12 21:46:39 +00:00
* The Excel Data Type of the cell.
* b Boolean, n Number, e Error, s String, d Date, z Empty
2017-05-12 21:46:39 +00:00
*/
t: ExcelDataType;
2017-03-12 07:21:11 +00:00
/** Cell formula (if applicable) */
2017-03-12 07:21:11 +00:00
f?: string;
/** Range of enclosing array if formula is array formula (if applicable) */
2017-03-12 07:21:11 +00:00
F?: string;
/** Rich text encoding (if applicable) */
r?: any;
/** HTML rendering of the rich text (if applicable) */
2017-03-12 07:21:11 +00:00
h?: string;
/** Comments associated with the cell */
2020-01-28 01:20:38 +00:00
c?: Comments;
/** Number format string associated with the cell (if requested) */
z?: NumberFormat;
/** Cell hyperlink object (.Target holds link, .tooltip is tooltip) */
l?: Hyperlink;
/** The style/theme of the cell (if applicable) */
s?: any;
}
2017-06-19 07:14:14 +00:00
/** Simple Cell Address */
export interface CellAddress {
2017-03-12 07:21:11 +00:00
/** Column number */
c: number;
2017-03-12 07:21:11 +00:00
/** Row number */
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 */
s: CellAddress;
2017-03-12 07:21:11 +00:00
/** Ending cell */
e: CellAddress;
}
export interface Sheet2CSVOpts extends DateNFOption {
/** Field Separator ("delimiter") */
FS?: string;
/** Record Separator ("row separator") */
RS?: string;
/** 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;
/** Force quotes around fields */
forceQuotes?: boolean;
/** if true, return raw numbers; if false, return formatted numbers */
rawNumbers?: boolean;
}
export interface OriginOption {
/** Top-Left cell for operation (CellAddress or A1 string or row) */
origin?: number | string | CellAddress;
}
export interface Sheet2HTMLOpts {
/** TABLE element id attribute */
id?: string;
2017-06-19 07:14:14 +00:00
/** Add contenteditable to every cell */
editable?: boolean;
2017-06-19 07:14:14 +00:00
/** Header HTML */
header?: string;
2017-06-19 07:14:14 +00:00
/** Footer HTML */
footer?: string;
}
export interface Sheet2JSONOpts extends DateNFOption {
2017-06-19 07:14:14 +00:00
/** Output format */
header?: "A"|number|string[];
2017-06-19 07:14:14 +00:00
/** Override worksheet range */
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 */
raw?: boolean;
/** if true, skip hidden rows and columns */
skipHidden?: boolean;
/** if true, return raw numbers; if false, return formatted numbers */
rawNumbers?: boolean;
}
export interface AOA2SheetOpts extends CommonOptions, DateNFOption {
/**
* Create cell objects for stub cells
* @default false
*/
sheetStubs?: boolean;
}
export interface SheetAOAOpts extends AOA2SheetOpts, OriginOption {}
export interface JSON2SheetOpts extends CommonOptions, DateNFOption {
/** Use specified column order */
header?: string[];
/** Skip header row in generated sheet */
skipHeader?: boolean;
}
export interface SheetJSONOpts extends JSON2SheetOpts, OriginOption {}
export interface Table2SheetOpts extends CommonOptions, DateNFOption, OriginOption, SheetOption {
/** If true, plaintext parsing will not parse values */
raw?: boolean;
/**
* If >0, read the first sheetRows rows
* @default 0
*/
sheetRows?: number;
/** If true, hidden rows and cells will not be parsed */
display?: boolean;
}
2017-06-19 07:14:14 +00:00
/** General utilities */
export interface XLSX$Utils {
/* --- 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;
/** BROWSER ONLY! Converts a TABLE DOM element to a worksheet. */
table_to_sheet(data: any, opts?: Table2SheetOpts): WorkSheet;
table_to_book(data: any, opts?: Table2SheetOpts): WorkBook;
sheet_add_dom(ws: WorkSheet, data: any, opts?: Table2SheetOpts): WorkSheet;
/* --- 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 */
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-03-12 07:21:11 +00:00
/** Generates delimiter-separated-values output */
sheet_to_csv(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
/** Generates UTF16 Formatted Text */
sheet_to_txt(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
/** Generates HTML */
sheet_to_html(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
2017-03-12 07:21:11 +00:00
/** Generates a list of the formulae (with value fallbacks) */
sheet_to_formulae(worksheet: WorkSheet): string[];
2017-03-12 07:21:11 +00:00
/** Generates DIF */
sheet_to_dif(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
/** Generates SYLK (Symbolic Link) */
sheet_to_slk(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
/** Generates ETH */
sheet_to_eth(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
/* --- Cell Address Utilities --- */
2017-03-12 07:21:11 +00:00
/** Converts 0-indexed cell address to A1 form */
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-03-12 07:21:11 +00:00
/** Converts 0-indexed column to A1 form */
encode_col(col: number): string;
2017-03-12 07:21:11 +00:00
/** Converts 0-indexed range to A1 form */
encode_range(s: CellAddress, e: CellAddress): string;
encode_range(r: Range): string;
2017-03-12 07:21:11 +00:00
/** Converts A1 cell address to 0-indexed form */
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-03-12 07:21:11 +00:00
/** Converts A1 column to 0-indexed form */
decode_col(col: string): number;
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
/** 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
2017-06-19 07:14:14 +00:00
/** Creates a new workbook */
2017-06-17 20:45:03 +00:00
book_new(): WorkBook;
/** 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;
/** 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 */
sheet_set_array_formula(ws: WorkSheet, range: Range|string, formula: string, dynamic?: boolean): WorkSheet;
2017-06-19 07:14:14 +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 */
sheet_add_json(ws: WorkSheet, data: any[], opts?: SheetJSONOpts): WorkSheet;
sheet_add_json<T>(ws: WorkSheet, data: T[], opts?: SheetJSONOpts): WorkSheet;
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;
}
/** 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;
/** JSON object stream, generate one row at a time */
to_json(sheet: WorkSheet, opts?: Sheet2JSONOpts): any;
/** Set `Readable` (internal) */
set_readable(Readable: any): void;
}