We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Missing worksheets in the Excel workbook when saved

Hello there,

we have a highly business critical problem of missing worksheets in the reports generated using Aspose.Cells. We keep adding the worksheets to the Aspose.Cells.Workbook and when all the worksheets are added we save them to the physical path using Workbook.Save function, however when saved we see some worksheets are missing randomly. we tried multiple ways to tackle it but none worked. what we should do here?

@krisuday,

Thanks for providing us some details.

Well, I think the issue might be due to your own code (which is either removing/hiding those missing sheets or you are not adding those sheets at the first place rather overwriting them) or something else. You should debug your own code (line by line), let each line to be processed and check properties/values for the objects to try to find the issue. Once you find the issue, you may figure it out by yourself. Are you adding sheets in multiple threads to the workbook? Well, you should not share single Workbook object in multiple threads as this is not recommend and good approach. However, multiple threads can have their own Workbook objects or different files. But if you still want to share a single Workbook in multiple threads to add worksheets, then you will have to use Semaphore or Mutexes or Monitor to control concurrency by yourself using your own code. Even these things will not make the output Workbook stable enough as Excel workbooks may have some shared resources/data. Here, the good way is that you should use separate Workbook object for your every thread and then once you are done with your processing, you may combine all workbooks into a single workbook using Workbook.Combine() method.