@birchui/excel
Excel Engine: xlsx writer and reader, cell references, date serials and zip helpers.
Key exports: writeXlsx, downloadXlsx, readXlsx, sheetToObjects, XlsxWorkbook, XlsxSheet, XlsxCellStyle
Guides: Freeze panes, outlines and merges, Excel Engine overview, Reading files, Styles and number formats, Troubleshooting, Utilities
Functions#
cellReffunction#
function cellRef(rowIndex: number, colIndex: number): string| Parameter | Type | Description |
|---|---|---|
rowIndex | number | — |
colIndex | number | — |
Defined in packages/excel/src/cells.ts:28
columnLetterfunction#
function columnLetter(index: number): string| Parameter | Type | Description |
|---|---|---|
index | number | — |
Defined in packages/excel/src/cells.ts:14
dateToSerialfunction#
function dateToSerial(date: Date): number| Parameter | Type | Description |
|---|---|---|
date | Date | — |
Defined in packages/excel/src/dates.ts:7
downloadXlsxfunction#
function downloadXlsx(workbook: XlsxWorkbook, fileName: string, options: XlsxWriteOptions = {}): Promise<void>| Parameter | Type | Description |
|---|---|---|
workbook | XlsxWorkbook | — |
fileName | string | — |
optionsoptional | XlsxWriteOptions | — |
Defined in packages/excel/src/writer.ts:193
parseCellReffunction#
function parseCellRef(ref: string): CellPosition| Parameter | Type | Description |
|---|---|---|
ref | string | — |
Defined in packages/excel/src/cells.ts:37
readXlsxfunction#
function readXlsx(data: Uint8Array | ArrayBuffer | Blob, options: XlsxReadOptions = {}): Promise<XlsxReadResult>| Parameter | Type | Description |
|---|---|---|
data | Uint8Array | ArrayBuffer | Blob | — |
optionsoptional | XlsxReadOptions | — |
Defined in packages/excel/src/reader.ts:326
serialToDatefunction#
function serialToDate(serial: number): Date| Parameter | Type | Description |
|---|---|---|
serial | number | — |
Defined in packages/excel/src/dates.ts:13
sheetToObjectsfunction#
function sheetToObjects(sheet: XlsxReadSheet, options: { headerRow?: number } = {}): Record<string, XlsxPrimitive>[]| Parameter | Type | Description |
|---|---|---|
sheet | XlsxReadSheet | — |
optionsoptional | { headerRow?: number } | — |
Defined in packages/excel/src/reader.ts:366
unzipfunction#
function unzip(data: Uint8Array, options: UnzipOptions = {}): Promise<Map<string, Uint8Array>>| Parameter | Type | Description |
|---|---|---|
data | Uint8Array | — |
optionsoptional | UnzipOptions | — |
Defined in packages/excel/src/zip.ts:392
writeXlsxfunction#
function writeXlsx(workbook: XlsxWorkbook, options: XlsxWriteOptions = {}): Promise<Uint8Array>| Parameter | Type | Description |
|---|---|---|
workbook | XlsxWorkbook | — |
optionsoptional | XlsxWriteOptions | — |
Defined in packages/excel/src/writer.ts:185
writeXlsxSyncfunction#
function writeXlsxSync(workbook: XlsxWorkbook, options: Pick<XlsxWriteOptions, 'licenseKey'> = {}): Uint8Array| Parameter | Type | Description |
|---|---|---|
workbook | XlsxWorkbook | — |
optionsoptional | Pick<XlsxWriteOptions, 'licenseKey'> | — |
Defined in packages/excel/src/writer.ts:180
zipfunction#
function zip(files: ZipInputFile[], options: { compress?: boolean } = {}): Promise<Uint8Array>| Parameter | Type | Description |
|---|---|---|
files | ZipInputFile[] | — |
optionsoptional | { compress?: boolean } | — |
Defined in packages/excel/src/zip.ts:215
zipSyncfunction#
function zipSync(files: ZipInputFile[]): Uint8Array| Parameter | Type | Description |
|---|---|---|
files | ZipInputFile[] | — |
Defined in packages/excel/src/zip.ts:211
Classes#
ZipLimitErrorclass#
class ZipLimitError extends Error
new ZipLimitError(code: ZipLimitCode, message: string, detail: { limit: number; actual: number; entryName?: string })| Member | Type | Description |
|---|---|---|
codereadonly | ZipLimitCode | — |
limitreadonly | number | — |
actualreadonly | number | — |
entryNamereadonly | string | undefined | — |
Defined in packages/excel/src/zip.ts:39
Constants#
DEFAULT_ZIP_LIMITSconst#
const DEFAULT_ZIP_LIMITS: Readonly<ZipLimits>Defined in packages/excel/src/zip.ts:32
Interfaces#
UnzipOptionsinterface#
interface UnzipOptionsDefined in packages/excel/src/types.ts:99
XlsxBorderSideinterface#
interface XlsxBorderSide| Property | Type | Description |
|---|---|---|
style | 'thin' | 'medium' | 'thick' | 'dashed' | 'dotted' | 'double' | — |
coloroptional | string | — |
Defined in packages/excel/src/types.ts:10
XlsxBorderSidesinterface#
interface XlsxBorderSides| Property | Type | Description |
|---|---|---|
topoptional | XlsxBorderSide | — |
rightoptional | XlsxBorderSide | — |
bottomoptional | XlsxBorderSide | — |
leftoptional | XlsxBorderSide | — |
Defined in packages/excel/src/types.ts:15
XlsxCellinterface#
interface XlsxCell| Property | Type | Description |
|---|---|---|
value | XlsxPrimitive | XlsxFormula | — |
styleoptional | XlsxCellStyle | — |
Defined in packages/excel/src/types.ts:43
XlsxCellStyleinterface#
interface XlsxCellStyle| Property | Type | Description |
|---|---|---|
fontoptional | XlsxFont | — |
boldoptional | boolean | — |
italicoptional | boolean | — |
coloroptional | string | — |
filloptional | string | — |
numFmtoptional | string | — |
alignoptional | 'left' | 'center' | 'right' | — |
valignoptional | 'top' | 'center' | 'bottom' | — |
wrapoptional | boolean | — |
indentoptional | number | — |
borderoptional | XlsxBorderSide | XlsxBorderSides | — |
Defined in packages/excel/src/types.ts:22
XlsxColumninterface#
interface XlsxColumn| Property | Type | Description |
|---|---|---|
widthoptional | number | — |
outlineLeveloptional | number | — |
styleoptional | XlsxCellStyle | — |
Defined in packages/excel/src/types.ts:59
XlsxFontinterface#
interface XlsxFont| Property | Type | Description |
|---|---|---|
boldoptional | boolean | — |
italicoptional | boolean | — |
underlineoptional | boolean | — |
coloroptional | string | — |
sizeoptional | number | — |
nameoptional | string | — |
Defined in packages/excel/src/types.ts:1
XlsxFormulainterface#
interface XlsxFormula| Property | Type | Description |
|---|---|---|
formula | string | — |
valueoptional | XlsxPrimitive | — |
Defined in packages/excel/src/types.ts:38
XlsxReadOptionsinterface#
interface XlsxReadOptions| Property | Type | Description |
|---|---|---|
licenseKeyoptional | string | — |
limitsoptional | Partial<ZipLimits> | — |
Defined in packages/excel/src/types.ts:103
XlsxReadResultinterface#
interface XlsxReadResult| Property | Type | Description |
|---|---|---|
sheets | XlsxReadSheet[] | — |
Defined in packages/excel/src/types.ts:114
XlsxReadSheetinterface#
interface XlsxReadSheet| Property | Type | Description |
|---|---|---|
name | string | — |
rows | XlsxPrimitive[][] | — |
merges | string[] | — |
Defined in packages/excel/src/types.ts:108
XlsxRowinterface#
interface XlsxRow| Property | Type | Description |
|---|---|---|
cells | XlsxCellInput[] | — |
outlineLeveloptional | number | — |
collapsedoptional | boolean | — |
heightoptional | number | — |
styleoptional | XlsxCellStyle | — |
Defined in packages/excel/src/types.ts:50
XlsxSheetinterface#
interface XlsxSheet| Property | Type | Description |
|---|---|---|
name | string | — |
columnsoptional | XlsxColumn[] | — |
rows | (XlsxRow | XlsxCellInput[])[] | — |
freezeoptional | { rows?: number; columns?: number } | — |
autoFilteroptional | boolean | string | — |
mergesoptional | string[] | — |
outlineSummaryBelowoptional | boolean | — |
rightToLeftoptional | boolean | — |
tabColoroptional | string | — |
Defined in packages/excel/src/types.ts:66
XlsxWorkbookinterface#
interface XlsxWorkbook| Property | Type | Description |
|---|---|---|
sheets | XlsxSheet[] | — |
creatoroptional | string | — |
createdoptional | Date | — |
titleoptional | string | — |
Defined in packages/excel/src/types.ts:78
XlsxWriteOptionsinterface#
interface XlsxWriteOptions| Property | Type | Description |
|---|---|---|
compressoptional | boolean | — |
licenseKeyoptional | string | — |
Defined in packages/excel/src/types.ts:85
ZipInputFileinterface#
interface ZipInputFileDefined in packages/excel/src/types.ts:118
ZipLimitsinterface#
interface ZipLimits| Property | Type | Description |
|---|---|---|
maxEntries | number | — |
maxEntryBytes | number | — |
maxTotalBytes | number | — |
maxRatio | number | — |
Defined in packages/excel/src/types.ts:90
Types#
XlsxCellInputtype#
type XlsxCellInput = XlsxCell | XlsxPrimitive;Defined in packages/excel/src/types.ts:48
XlsxPrimitivetype#
type XlsxPrimitive = string | number | boolean | Date | null | undefined;Defined in packages/excel/src/types.ts:36
ZipLimitCodetype#
type ZipLimitCode = 'too-many-entries' | 'entry-too-large' | 'archive-too-large' | 'ratio-too-high';Defined in packages/excel/src/types.ts:97