1

I am using Gembox-spreadsheet to parse excel files with multiple sheets.

I am currently loading a file using the following code:

excelFile.LoadXlsx(inputExcel, XlsxOptions.None);

where inputExcel is a fullpath. After importing the excel, I try to access its content (for each sheet, parse rows and obtain cell data). The problem here is that after loading the document, in debug mode if I check the values in a sheet, I see this error:

'excelFile.Worksheets.ActiveWorksheet.Cells.Value' threw an exception of type 'System.InvalidOperationException'.

However, when I try to retrieve the information from a cell (which contains some info, doesn't matter of which type) it retrieves 0.

Does anybody know why this error occurs and how I can prevent it?

I must mention that the values in the cells are generated through formulas, from a separate worksheet. Could this be why the values are not loaded?

gunr2171
  • 16,104
  • 25
  • 61
  • 88
user2399378
  • 829
  • 2
  • 10
  • 23

1 Answers1

0

Well, I found the problem. Because the cell values are obtained through formulas, when loading the file you must set XlsxOptions.PreserveWorksheetRecords (for xls) or XlsOptions.PreserveKeepOpen (for xlsx)

user2399378
  • 829
  • 2
  • 10
  • 23