I have a Microsoft.Office.Interop.Excel.Range Object obtained as shown:
Dim maxRow As Integer = currentSheet.UsedRange.Rows.Count
currentSheet.Range("A2").Resize(maxRow-1, 2).Value
and I'm trying to convert that to a 2 dimensional array of doubles, but if I do:
Dim arrayData(,) As Double = currentSheet.Range("A2").Resize(maxRow - 1, 2).Value
I get the following error:
Additional information: Unable to cast object of type 'System.Object[,]' to type 'System.Double[,]'.
Is there a simple way to obtain the data from a spreadsheet as an array of doubles? I could loop over each element in the array, but it seems like that shouldn't be necessary.