interface CellCoord { row: number; col: number; } declare const coordinateToIndex: (coordinate: string) => CellCoord; declare const indexToCoordinate: (row: number, col: number) => string; declare const EXCEL_ERRORS: readonly ["#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"]; declare const BORDER_STYLES: readonly ["thin", "medium", "thick", "dashed", "dotted", "double", "hair", "mediumDashed", "dashDot", "mediumDashDot", "dashDotDot", "mediumDashDotDot", "slantDashDot"]; declare const BORDER_SIDES: readonly ["left", "right", "top", "bottom"]; type BorderStyleName = (typeof BORDER_STYLES)[number]; type BorderSideName = (typeof BORDER_SIDES)[number]; interface BorderLine { style: BorderStyleName; color?: string; } type BorderSide = BorderStyleName | BorderLine; type BorderLines = { [side in BorderSideName]?: BorderLine; }; type BorderSides = { [side in BorderSideName]?: BorderSide; } & { style?: never; color?: never; }; type ParsedBorder = true | BorderLines; type CellBorder = boolean | BorderSide | BorderSides; type ExcelErrorValue = (typeof EXCEL_ERRORS)[number]; interface ErrorCell { error: ExcelErrorValue; formula?: never; text?: never; } interface TextCell { text: string; formula?: never; error?: never; } type FormulaResult = string | number | boolean | Date | ErrorCell; interface FormulaCell { formula: string; result?: FormulaResult; text?: never; error?: never; } type CellValue = string | number | boolean | Date | null | undefined | FormulaCell | TextCell | ErrorCell; type DataValidationType = 'list' | 'whole' | 'decimal' | 'textLength' | 'date' | 'time' | 'custom'; type SheetState = 'visible' | 'hidden' | 'veryHidden'; type DataValidationOperator = 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual'; interface CellValidation { range: string; /** Legacy list shorthand: comma-separated allowed values (used when `type` is 'list' or unset). */ options: string; type?: DataValidationType; operator?: DataValidationOperator; formula1?: string; formula2?: string; allowBlank?: boolean; } interface ConditionalFormatStyle { background?: string; color?: string; bold?: boolean; italic?: boolean; } type ConditionalFormatOperator = 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'equal' | 'notEqual' | 'between' | 'notBetween'; interface CellValueConditionalFormat { type: 'cellValue'; range: string; operator: ConditionalFormatOperator; value: number | string; value2?: number | string; style: ConditionalFormatStyle; } interface ExpressionConditionalFormat { type: 'expression'; range: string; formula: string; style: ConditionalFormatStyle; } interface ColorScaleConditionalFormat { type: 'colorScale'; range: string; colors: [string, string] | [string, string, string]; } type ConditionalFormat = CellValueConditionalFormat | ExpressionConditionalFormat | ColorScaleConditionalFormat; interface AutoFilter { range: string; } interface ExternalHyperlink { range: string; url: string; location?: never; tooltip?: string; display?: string; } interface InternalHyperlink { range: string; location: string; url?: never; tooltip?: string; display?: string; } type Hyperlink = ExternalHyperlink | InternalHyperlink; interface SheetLayout { rowHeights?: Record; hiddenRows?: number[]; hiddenColumns?: number[]; } interface CellStyle { background?: string; border?: CellBorder; bold?: boolean; italic?: boolean; underline?: boolean; color?: string; fontSize?: number; fontName?: string; align?: 'left' | 'center' | 'right'; verticalAlign?: 'top' | 'middle' | 'bottom'; wrapText?: boolean; numberFormat?: string; } type ParsedCellStyle = Omit & { border?: ParsedBorder; }; type RangeOperator = Exclude; /** * Typed builders for cell data validations. Each returns a {@link CellValidation} * ready to drop into a sheet's `validations` array or `Workbook.addValidation`. */ declare const dataValidation: { list(range: string, values: string[]): CellValidation; wholeNumber(range: string, operator: RangeOperator, value: number, value2?: number): CellValidation; decimal(range: string, operator: RangeOperator, value: number, value2?: number): CellValidation; textLength(range: string, operator: RangeOperator, value: number, value2?: number): CellValidation; dateBetween(range: string, start: Date, end: Date): CellValidation; }; type HyperlinkOptions = Pick; declare const hyperlink: { url(range: string, url: string, options?: HyperlinkOptions): ExternalHyperlink; email(range: string, address: string, options?: HyperlinkOptions & { subject?: string; }): ExternalHyperlink; internal(range: string, sheet: string, cell?: string, options?: HyperlinkOptions): InternalHyperlink; }; interface SheetOptions extends SheetLayout { name?: string; state?: SheetState; freezePane?: { row?: number; col?: number; }; autoWidth?: boolean; columnWidths?: number[]; autoFilter?: AutoFilter; } interface ExcelWriterOptions { creator?: string; title?: string; subject?: string; sharedStrings?: boolean; } interface ExcelData { data: CellValue[][]; validations?: CellValidation[]; styles?: Record; mergeCells?: string[]; conditionalFormats?: ConditionalFormat[]; hyperlinks?: Hyperlink[]; options?: SheetOptions; } declare class ExcelWriter { private _options; constructor(options?: ExcelWriterOptions); createWorkbook(data: ExcelData[]): Blob; createWorkbookBuffer(data: ExcelData[]): Uint8Array; private generateFiles; private buildSharedStrings; addValidation(data: ExcelData[], range: string, options: string): ExcelData[]; addStyle(data: ExcelData[], rowIndex: number, colIndex: number, style: CellStyle): ExcelData[]; static createSimple(data: CellValue[][], options?: ExcelWriterOptions): Blob; static createSimpleBuffer(data: CellValue[][], options?: ExcelWriterOptions): Uint8Array; } declare const createExcelFile: (data: CellValue[][], options?: ExcelWriterOptions) => Blob; declare const createExcelFileBuffer: (data: CellValue[][], options?: ExcelWriterOptions) => Uint8Array; interface ParsedCell { value: any; type: 'string' | 'number' | 'boolean' | 'date' | 'error' | 'empty'; coordinate: string; rowIndex: number; columnIndex: number; formula?: string; } interface ParsedSheet extends SheetLayout { name: string; data: ParsedCell[][]; validations: CellValidation[]; state?: Exclude; styles?: Record; mergeCells?: string[]; freezePane?: { row?: number; col?: number; }; columnWidths?: number[]; conditionalFormats?: ConditionalFormat[]; autoFilter?: AutoFilter; hyperlinks?: Hyperlink[]; } interface ParsedWorkbook { sheets: ParsedSheet[]; metadata: { created?: string; modified?: string; creator?: string; title?: string; subject?: string; }; } declare class ExcelReader { private parser; constructor(); parseFromFile(file: File): Promise; parseFromBuffer(buffer: Uint8Array): ParsedWorkbook; private parseRelationships; private parseWorkbookRels; private resolveSheetPath; private parseSharedStrings; private extractStringItem; private extractText; private parseStyleSheet; private decodeBorder; private argbToHex; private decodeCellStyle; private parseSheet; private parseValidation; private parseHyperlinks; private parseConditionalFormats; private parseCfRule; private parseCfValue; private parseFreezePane; private parseColumns; private parseCell; private columnLetterToIndex; private columnIndexToLetter; private extractMetadata; } declare const parseExcel: (buffer: Uint8Array) => ParsedWorkbook; interface WorkbookMetadata { creator?: string; title?: string; subject?: string; } declare class Workbook { private sheets; private metadata; private constructor(); static create(): Workbook; static fromBuffer(buffer: Uint8Array): Workbook; static fromFile(file: File): Promise; private static fromParsed; getSheetNames(): string[]; getMetadata(): WorkbookMetadata; setMetadata(metadata: WorkbookMetadata): void; private findSheet; addSheet(name: string, data?: CellValue[][]): void; renameSheet(from: string, to: string): void; removeSheet(name: string): void; getSheetData(name: string): CellValue[][]; getCellValue(sheetName: string, row: number, col: number): CellValue; setCellValue(sheetName: string, row: number, col: number, value: CellValue): void; getCellStyle(sheetName: string, row: number, col: number): CellStyle | undefined; setCellStyle(sheetName: string, row: number, col: number, style: CellStyle): void; getSheetState(sheetName: string): SheetState; setSheetState(sheetName: string, state: SheetState): void; setMergeCells(sheetName: string, ranges: string[]): void; setFreezePane(sheetName: string, pane: { row?: number; col?: number; }): void; setColumnWidths(sheetName: string, widths: number[]): void; setRowHeight(sheetName: string, row: number, height: number | null): void; getRowHeight(sheetName: string, row: number): number | undefined; setRowHidden(sheetName: string, row: number, hidden?: boolean): void; isRowHidden(sheetName: string, row: number): boolean; setColumnHidden(sheetName: string, col: number, hidden?: boolean): void; isColumnHidden(sheetName: string, col: number): boolean; setAutoWidth(sheetName: string, enabled: boolean): void; addValidation(sheetName: string, validation: CellValidation): void; addConditionalFormat(sheetName: string, format: ConditionalFormat): void; setAutoFilter(sheetName: string, autoFilter: AutoFilter): void; getAutoFilter(sheetName: string): AutoFilter | undefined; removeAutoFilter(sheetName: string): void; setHyperlink(sheetName: string, hyperlink: Hyperlink): void; getHyperlinks(sheetName: string): Hyperlink[]; removeHyperlink(sheetName: string, range: string): void; private toExcelData; toBuffer(options?: Partial): Uint8Array; toBlob(options?: Partial): Blob; } interface StreamingSheetInput extends SheetLayout { name?: string; rows: Iterable | AsyncIterable; styles?: Record; freezePane?: { row?: number; col?: number; }; columnWidths?: number[]; mergeCells?: string[]; autoFilter?: AutoFilter; hyperlinks?: Hyperlink[]; } declare function createExcelWorkbookStream(sheets: StreamingSheetInput[], options?: ExcelWriterOptions): AsyncGenerator; declare function streamToBuffer(stream: AsyncGenerator): Promise; interface ExcelFiles { [path: string]: string; } declare const createExcelBlob: (files: ExcelFiles) => Blob; declare const createExcelBuffer: (files: ExcelFiles) => Uint8Array; declare const extractExcelFiles: (buffer: Uint8Array) => ExcelFiles; declare const validateExcelStructure: (files: ExcelFiles) => boolean; declare const XML_NS: { readonly spreadsheetml: "http://schemas.openxmlformats.org/spreadsheetml/2006/main"; readonly relationships: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"; readonly main_rel: "http://schemas.openxmlformats.org/package/2006/relationships"; readonly content_types: "http://schemas.openxmlformats.org/package/2006/content-types"; }; declare const CONTENT_TYPES: { readonly XML: "application/xml"; readonly RELATIONSHIPS: "application/vnd.openxmlformats-package.relationships+xml"; readonly SPREADSHEETML: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"; readonly WORKSHEET: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"; readonly SHARED_STRINGS: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"; readonly STYLES: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"; }; declare const RELATIONSHIP_TYPES: { readonly WORKSHEET: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"; readonly SHARED_STRINGS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"; readonly STYLES: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; }; declare const CELL_TYPES: { readonly INLINE_STRING: "inlineStr"; readonly SHARED_STRING: "s"; readonly NUMBER: "n"; readonly BOOLEAN: "b"; readonly ERROR: "e"; }; interface CellAlignment { horizontal?: 'left' | 'center' | 'right'; vertical?: 'top' | 'middle' | 'bottom'; wrapText?: boolean; } interface ExcelStyle { fontId: number; fillId: number; borderId: number; numFmtId: number; applyFont?: boolean; applyFill?: boolean; applyBorder?: boolean; applyNumberFormat?: boolean; alignment?: CellAlignment; } interface Font { bold?: boolean; italic?: boolean; underline?: boolean; color?: string; size?: number; name?: string; } interface Fill { fgColor?: string; bgColor?: string; patternType?: string; } interface Border { left?: boolean; right?: boolean; top?: boolean; bottom?: boolean; color?: string; } declare class StyleManager { private fonts; private fills; private borders; private numFmts; private dxfs; private cellXfs; private styleIds; constructor(); getStyleId(style: CellStyle): number; getDateStyleId(style?: CellStyle): number; private registerStyle; private internXf; generateFontsXml(): string; generateFillsXml(): string; generateBordersXml(): string; generateCellXfsXml(): string; generateNumFmtsXml(): string; getNumFmtsCount(): number; getDxfId(style: ConditionalFormatStyle): number; generateDxfsXml(): string; getDxfsCount(): number; getFontsCount(): number; getFillsCount(): number; getBordersCount(): number; getCellXfsCount(): number; } interface SheetGenerationOptions extends SheetLayout { freezePane?: { row?: number; col?: number; }; autoWidth?: boolean; columnWidths?: number[]; mergeCells?: string[]; conditionalFormats?: ConditionalFormat[]; sharedStrings?: Map; autoFilter?: AutoFilter; hyperlinks?: Hyperlink[]; } interface DefinedName { name: string; value: string; localSheetId?: number; hidden?: boolean; } declare const generateSheetRelsXml: (hyperlinks?: Hyperlink[]) => string; declare const generateSheetXml: (data: CellValue[][], validations?: CellValidation[], styles?: Record, styleManager?: StyleManager, options?: SheetGenerationOptions) => string; declare const generateSharedStringsXml: (strings: string[]) => string; declare const generateStylesXml: (styleManager?: StyleManager) => string; declare const generateContentTypesXml: (sheetCount?: number, hasSharedStrings?: boolean) => string; declare const generateWorkbookXml: (sheetNames?: string[], definedNames?: DefinedName[], sheetStates?: SheetState[]) => string; declare const generateWorkbookRelsXml: (sheetCount?: number, hasSharedStrings?: boolean) => string; declare const generateCorePropsXml: (creator?: string, title?: string, subject?: string) => string; declare const generateAppPropsXml: () => string; declare const generateRootRelsXml: () => string; declare function dateToExcelSerial(date: Date): number; declare function excelSerialToDate(serial: number): Date; declare function isDate(value: unknown): value is Date; declare function isDateNumFmtId(numFmtId: number, customFormats?: Record): boolean; declare function isDateFormatCode(code: string): boolean; declare const EXCEL_LIMITS: { readonly MAX_ROWS: 1048576; readonly MAX_COLS: 16384; readonly MAX_CELL_LENGTH: 32767; readonly MAX_HYPERLINKS: 65530; readonly MAX_HYPERLINK_LENGTH: 2079; }; declare function validateRowIndex(row: number): void; declare function validateColIndex(col: number): void; declare function validateCellValue(value: string): void; declare function calculateColumnWidths(data: any[][]): number[]; declare function generateColsXml(widths: number[], { hiddenColumns }?: { hiddenColumns?: Iterable; }): string; declare const ExcelBridge: { read: (buffer: Uint8Array) => ParsedWorkbook; readFromFile: (file: File) => Promise; write: (data: CellValue[][], options?: ExcelWriterOptions) => Blob; writeBuffer: (data: CellValue[][], options?: ExcelWriterOptions) => Uint8Array; coordinateToIndex: (coordinate: string) => CellCoord; indexToCoordinate: (row: number, col: number) => string; Writer: typeof ExcelWriter; Reader: typeof ExcelReader; Workbook: typeof Workbook; }; export { type AutoFilter, type Border, type BorderLine, type BorderLines, type BorderSide, type BorderSideName, type BorderSides, type BorderStyleName, CELL_TYPES, CONTENT_TYPES, type CellAlignment, type CellBorder, type CellStyle, type CellValidation, type CellValue, type CellValueConditionalFormat, type ColorScaleConditionalFormat, type ConditionalFormat, type ConditionalFormatOperator, type ConditionalFormatStyle, type DataValidationOperator, type DataValidationType, type DefinedName, EXCEL_LIMITS, type ErrorCell, ExcelBridge, type ExcelData, type ExcelErrorValue, type ExcelFiles, ExcelReader, type ExcelStyle, ExcelWriter, type ExcelWriterOptions, type ExpressionConditionalFormat, type ExternalHyperlink, type Fill, type Font, type FormulaCell, type FormulaResult, type Hyperlink, type HyperlinkOptions, type InternalHyperlink, type ParsedBorder, type ParsedCell, type ParsedCellStyle, type ParsedSheet, type ParsedWorkbook, RELATIONSHIP_TYPES, type SheetGenerationOptions, type SheetLayout, type SheetOptions, type SheetState, type StreamingSheetInput, StyleManager, type TextCell, Workbook, type WorkbookMetadata, XML_NS, calculateColumnWidths, coordinateToIndex, createExcelBlob, createExcelBuffer, createExcelFile, createExcelFileBuffer, createExcelWorkbookStream, dataValidation, dateToExcelSerial, excelSerialToDate, extractExcelFiles, generateAppPropsXml, generateColsXml, generateContentTypesXml, generateCorePropsXml, generateRootRelsXml, generateSharedStringsXml, generateSheetRelsXml, generateSheetXml, generateStylesXml, generateWorkbookRelsXml, generateWorkbookXml, hyperlink, indexToCoordinate, isDate, isDateFormatCode, isDateNumFmtId, parseExcel, streamToBuffer, validateCellValue, validateColIndex, validateExcelStructure, validateRowIndex };