diff --git a/src/routes/excelGenerator/excelGeneratorModel.ts b/src/routes/excelGenerator/excelGeneratorModel.ts index 84ad603..3429c25 100644 --- a/src/routes/excelGenerator/excelGeneratorModel.ts +++ b/src/routes/excelGenerator/excelGeneratorModel.ts @@ -26,8 +26,9 @@ export const ExcelGeneratorRequestBodySchema = z title: z.string().optional().openapi({ description: 'The title of the table, which will be displayed in the first row.', }), - startCell: z.string().openapi({ - description: "The starting cell (e.g., 'A1') where the table will begin.", + startCell: z.string().optional().default('A1').openapi({ + description: + "The starting cell (e.g., 'A1') where the table will begin. Defaults to A1 if not specified.", }), columns: z .array( diff --git a/src/routes/excelGenerator/excelGeneratorRouter.ts b/src/routes/excelGenerator/excelGeneratorRouter.ts index 8695c7d..cc7570c 100644 --- a/src/routes/excelGenerator/excelGeneratorRouter.ts +++ b/src/routes/excelGenerator/excelGeneratorRouter.ts @@ -186,7 +186,7 @@ export function execGenExcelFuncs(sheetsData: SheetData[], excelConfigs: ExcelCo sheetsData.forEach(({ sheetName, tables }) => { const worksheet = workbook.addWorksheet(sheetName); - tables.forEach(({ startCell, title, rows = [], columns = [], skipHeader }) => { + tables.forEach(({ startCell = 'A1', title, rows = [], columns = [], skipHeader }) => { const startCol = columnLetterToNumber(startCell[0]); // Convert column letter to index (e.g., 'A' -> 1) const startRow = parseInt(startCell.slice(1)); // Extract the row number (e.g., 'A1' -> 1) let rowIndex = startRow; // Set the initial row index to startRow for each table