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

Free Support Forum - aspose.com

Workbook must contain at least a visible worksheet

Recently we have upgraded our license from version 8.1 to 18.6. We are facing some issues with older functionality.
We have a code which takes the excel bytes and generate new workbook. But now its throwing error while creating new workbook.
Code snippet -
private byte[] ConcatenateExcel(List<byte[]> resultList)
Workbook wb = new Workbook(FileFormatType.Xlsx);
foreach (var result in resultList)
var processingFile = new Workbook(new MemoryStream(result));
foreach (var ws in processingFile.Worksheets.OrderByDescending(sheet=>sheet.Index))//Order by descending in order to insert data sheet first.
var newSheetIndex = wb.Worksheets.Add();
var newWS = wb.Worksheets[newSheetIndex];
if (newWS != null)
newWS.Name = ws.Name;
newWS.Copy(ws, new CopyOptions() { CopyNames = true, ColumnCharacterWidth = true, CopyInvalidFormulasAsValues = true });
wb.Worksheets[newSheetIndex].IsVisible = ws.IsVisible; // We are getting exception here. As we try to insert first worksheet which is not visible. But others sheets are visible.

        return GetBytes(wb, "Excel");


Thanks for your query.

Please share your sample file with us for our testing. We will reproduce the problem and provide our feedback after analysis. Also mention the Aspose.Cells version which you are using for testing. If you are not using latest version, please use the latest version Aspose.Cells for .NET 18.7 and provide your feedback.