/** * Excel Formula Handler * Handles formula detection, calculation, and business rule conversion * * @module @f5/cli/core/excel-formula-handler * @version 1.0.0 */ import XLSX from 'xlsx'; export interface FormulaInfo { cell: string; formula: string; calculatedValue: unknown; formulaType: FormulaType; businessRule?: string; dependencies: string[]; sheetName: string; } export type FormulaType = 'calculation' | 'lookup' | 'conditional' | 'aggregation' | 'text' | 'date' | 'financial' | 'logical' | 'reference' | 'unknown'; export interface MergedCellInfo { range: string; startCell: string; endCell: string; value: unknown; rowSpan: number; colSpan: number; sheetName: string; } export interface ColorHighlight { cell: string; backgroundColor?: string; fontColor?: string; meaning?: string; sheetName: string; } export interface FormulaAnalysisResult { formulas: FormulaInfo[]; mergedCells: MergedCellInfo[]; colorHighlights: ColorHighlight[]; businessRules: BusinessRule[]; statistics: { totalFormulas: number; formulasByType: Record; totalMergedCells: number; totalHighlights: number; }; } export interface BusinessRule { id: string; description: string; sourceFormula: string; sourceCell: string; sheetName: string; category: string; } export declare class ExcelFormulaHandler { private workbook; constructor(workbook: XLSX.WorkBook); /** * Analyze all formulas in the workbook */ analyze(): FormulaAnalysisResult; /** * Extract formulas from a worksheet */ private extractFormulas; /** * Extract merged cells from a worksheet */ private extractMergedCells; /** * Extract color highlights from a worksheet */ private extractColorHighlights; /** * Detect the type of a formula */ private detectFormulaType; /** * Extract cell dependencies from a formula */ private extractDependencies; /** * Interpret color meaning */ private interpretColor; /** * Convert formula to business rule description */ private formulaToBusinessRule; /** * Generate markdown documentation of formulas */ generateFormulaDocumentation(result: FormulaAnalysisResult): string; } /** * Quick analysis function */ export declare function analyzeExcelFormulas(workbook: XLSX.WorkBook): FormulaAnalysisResult; /** * Get cell with both formula and value */ export declare function getCellWithFormula(sheet: XLSX.WorkSheet, cellRef: string): { value: unknown; formula?: string; } | null;