GemBox Support Forum

Worksheets.AddCopy gives "Value cannot be null"

When I try to copy a worksheet from one workbook to a new workbook (new file) I get the following:

Dim newFile As New GemBox.Spreadsheet.ExcelFile
newFile.Worksheets.AddCopy(mySheet.Name, mySheet)

ERROR: Value cannot be null
Parameter name: collection

(mySheet is a worksheet from another workbook.)

This exact same code worked in Gembox v41.3.30.1183…now Im using v47.0.1363

Am I doing something wrong

Hi Ton,

I’m afraid the issue is specific to your Excel file, can you please send it to us?

Also, please specify what is the name of your mySheet.


Hi Mario,

I don’t want to put the file on the public forum because it’s from a client…can I send it in a private message to you?

BR, Ton.

You can send it to us via email or send it to “Technical Support”, see our contact page.

The problem occurred because of a specific chart with a multi level axis.

Anyway, the issue is now resolved with this bugfix:

Or this NuGet package:
Install-Package GemBox.Spreadsheet -Version 47.0.1375-hotfix