I have managed to download your spreadsheet file (no idea what happened yesterday), and it contains the sequence 101, 102, ... in cells [1, 5], [1, 7] etc. I am able to access each of these values successfully with the following short code sequence:
Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
for (int i = 5; i < 20; i += 2)
{
string cellValue = xlWorksheet.Cells[1, i].Value.ToString();
Console.WriteLine("Cell[1, {0}]: {1}", i, foo);
}
which gives these results:
Cell[1, 5]: 101
Cell[1, 7]: 102
Cell[1, 9]: 103
Cell[1, 11]: 104
Cell[1, 13]: 105
Cell[1, 15]: 106
Cell[1, 17]: 107
Cell[1, 19]: 108
What I did notice is that cell[1, 5] contains the
value 101, whereas the remaining cells contain strings. Thus you cannot get the first cell
as string
, but need to use the
ToString()
method to convert it.