When reading from excel with Microsoft.office.Interop.Excel
and using Range dataRange = (Range)cSheet.Cells[row, col];
the performance is very slow. When I Remove Range dataRange = (Range)cSheet.Cells[row, col];
it is faster. What did I miss. What should I change ?
int rows = cSheet.UsedRange.Rows.Count;
int cols = cSheet.UsedRange.Columns.Count;
for (int row = 2; row <= rows; row++)
{
for (int col = 1; col <= cols; col++)
{
Range dataRange = (Range)cSheet.Cells[row, col];
}
}
You want to do it in one operation:
To get the UsedRange address for "A1:C4", try: