LightCell API - Create multiple sheets

Would it be possible to create a workbook with multiple sheets when using light cells api?
In StartSheet, I am only getting a call for the 0th sheet.
Thanks

@JosephGep

Yes, it is possible to create a workbook with multiple sheets when using the LightCells API. By default, a new Workbook object contains only one worksheet. To trigger the StartSheet method for additional sheets, you must first add those sheets to the workbook’s collection before saving.

When you call the workbook.Save method with LightCellsDataProvider, the process iterates through the existing sheets in the workbook. If your workbook only has one sheet (index 0), the handler will only fire once. To handle multiple sheets, simply use workbook.Worksheets.Add() for each additional sheet you require before initiating the save process.

In your implementation of LightCellsDataProvider.StartSheet(int sheetIndex), you can then use the index to determine which sheet is currently being processed and provide the corresponding data accordingly.

1 Like

Thanks for the quick reply. That solution helps

@JosephGep

You are very welcome! I am glad to hear that the explanation regarding the LightCells API and the worksheet initialization process helped resolve your query.

If you have any further questions or need additional assistance as you continue your implementation, please feel free to reach out. We are always happy to help.