I’m trying to use the Cells.ImportArray method to load data into a column of a spreadsheet, but it appears that this method loads the data as text (I’m using the string overload). My problem is that some of the data is text, some of it is numbers. If it gets all imported as text, the formulas that are applied to some of the values then fail.
What I’d like to use is something like the built-in:
worksheet.Cells.ImportArray(inputs, 0, 0, true);
My solution to this problem at the moment is to do the looping myself and set the values directly, but I wondered if there’s a more elegant solution to this?
FYI, what I’m using instead of the above is:
for (int i = 0; i < inputs.Length; ++i)
if (double.TryParse(inputs[i], out value))
worksheet.Cells[i, 0].Value = value;
worksheet.Cells[i, 0].Value = inputs[i];