import { IExcelReaderOptions, IExcelReaderDetailedOptions, IExcelReaderFlatOptions, IExcelReaderWorksheetOptions, ExcelReaderUnifiedResult, ExcelReaderResultUnified } from '../types/reader.types'; /** * ExcelReader class for reading Excel files and converting to JSON * * @example * ```typescript * // Using instance methods * const reader = new ExcelReader({ * outputFormat: OutputFormat.FLAT, * useFirstRowAsHeaders: true * }); * * const result = await reader.fromBuffer(arrayBuffer); * * // Using static methods (convenience) * const result2 = await ExcelReader.fromBuffer(arrayBuffer, { outputFormat: OutputFormat.DETAILED }); * ``` */ export declare class ExcelReader { private defaultOptions; /** * Creates a new ExcelReader instance with default options * * @param defaultOptions - Default options to use for all read operations */ constructor(defaultOptions?: IExcelReaderOptions); /** * Helper to create error result with correct typing */ private createErrorResult; /** * Read Excel file from Node.js Buffer or ArrayBuffer * * @param buffer - Node.js Buffer (preferred) or ArrayBuffer * @param options - Reading options * @returns Promise with the read result * * @example * ```typescript * // With detailed format - TypeScript knows the result type * const result = await reader.fromBuffer(buffer, { * outputFormat: OutputFormat.DETAILED * }); * if (result.success) { * result.data.cells; // TypeScript knows this is IDetailedFormat * } * * // With Node.js Buffer (from multer, fs, etc.) * const result = await reader.fromBuffer(req.file.buffer); * ``` */ fromBuffer(buffer: any, options: IExcelReaderDetailedOptions): Promise; fromBuffer(buffer: any, options: IExcelReaderFlatOptions): Promise; fromBuffer(buffer: any, options?: IExcelReaderWorksheetOptions): Promise; fromBuffer(buffer: any, // Node.js Buffer (preferred) or ArrayBuffer options?: IExcelReaderOptions): Promise; /** * Read Excel file from Blob */ fromBlob(blob: Blob, options: IExcelReaderDetailedOptions): Promise; fromBlob(blob: Blob, options: IExcelReaderFlatOptions): Promise; fromBlob(blob: Blob, options?: IExcelReaderWorksheetOptions): Promise; fromBlob(blob: Blob, options: IExcelReaderDetailedOptions): Promise; fromBlob(blob: Blob, options: IExcelReaderFlatOptions): Promise; fromBlob(blob: Blob, options?: IExcelReaderWorksheetOptions): Promise; /** * Read Excel file from File (browser) */ fromFile(file: File, options: IExcelReaderDetailedOptions): Promise; fromFile(file: File, options: IExcelReaderFlatOptions): Promise; fromFile(file: File, options?: IExcelReaderWorksheetOptions): Promise; fromFile(file: File, options: IExcelReaderDetailedOptions): Promise; fromFile(file: File, options: IExcelReaderFlatOptions): Promise; fromFile(file: File, options?: IExcelReaderWorksheetOptions): Promise; /** * Read Excel file from Node.js Buffer (Node.js only) * Useful when receiving files from multer or other Node.js file upload libraries * Note: This method only works in Node.js environment * @deprecated Use fromBuffer() directly, as it now accepts Buffer */ fromNodeBuffer(buffer: any, options: IExcelReaderDetailedOptions): Promise; fromNodeBuffer(buffer: any, options: IExcelReaderFlatOptions): Promise; fromNodeBuffer(buffer: any, options?: IExcelReaderWorksheetOptions): Promise; fromNodeBuffer(buffer: any, options: IExcelReaderDetailedOptions): Promise; fromNodeBuffer(buffer: any, options: IExcelReaderFlatOptions): Promise; fromNodeBuffer(buffer: any, options?: IExcelReaderWorksheetOptions): Promise; /** * Convenience static method that always returns the unified payload * for Blob input. */ static fromBlobUnified(blob: Blob, options?: IExcelReaderOptions): Promise; /** * Read Excel file from path (Node.js only) * Note: This method only works in Node.js environment */ fromPath(filePath: string, options: IExcelReaderDetailedOptions): Promise; fromPath(filePath: string, options: IExcelReaderFlatOptions): Promise; fromPath(filePath: string, options?: IExcelReaderWorksheetOptions): Promise; /** * Static method: Read Excel file from Node.js Buffer or ArrayBuffer (convenience method) */ static fromBuffer(buffer: any, options?: IExcelReaderOptions): Promise; /** * Convenience static method that always returns the unified payload * exposing `workbook`, `detailed` and `flat` optionally. */ static fromBufferUnified(buffer: any, options?: IExcelReaderOptions): Promise; /** * Static method: Read Excel file from Blob (convenience method) */ static fromBlob(blob: Blob, options?: IExcelReaderOptions): Promise; /** * Static method: Read Excel file from File (convenience method) */ static fromFile(file: File, options?: IExcelReaderOptions): Promise; /** * Convenience static method that always returns the unified payload * for File input. */ static fromFileUnified(file: File, options?: IExcelReaderOptions): Promise; /** * Static method: Read Excel file from Node.js Buffer (convenience method) * @deprecated Use fromBuffer() directly, as it now accepts Buffer */ static fromNodeBuffer(buffer: any, options?: IExcelReaderOptions): Promise; /** * Convenience static method that always returns the unified payload * for Node Buffer input. */ static fromNodeBufferUnified(buffer: any, options?: IExcelReaderOptions): Promise; /** * Static method: Read Excel file from path (convenience method) */ static fromPath(filePath: string, options?: IExcelReaderOptions): Promise; /** * Convenience static method that always returns the unified payload * for path input. */ static fromPathUnified(filePath: string, options?: IExcelReaderOptions): Promise; /** * Convert ExcelJS Workbook to JSON */ private convertWorkbookToJson; /** * Convert ExcelJS Worksheet to JSON */ private convertSheetToJson; /** * Convert ExcelJS Cell to JSON */ private convertCellToJson; /** * Convert workbook to detailed format (with position information) */ private convertToDetailedFormat; /** * Convert workbook to flat format (just data) */ private convertToFlatFormat; /** * Convert a single sheet to flat format */ private convertSheetToFlat; /** * Get cell value with type information */ private getCellValue; /** * Convert column number to letter (1 = A, 2 = B, 27 = AA, etc.) */ private numberToColumnLetter; } //# sourceMappingURL=ExcelReader.d.ts.map