I have this c# app. that opens an excel file and reads information from the spreadsheet then takes this info and sticks it in a datatable. Then from there I can just loop through my rows and get my infomation back. dRow["Direction"].
It's all done in a loop. Problem is this is taking a very long time to read through.
I found this line of code. Array Myvals = workSheet.UsedRange.Cells.Value2 as Array;
That works super fast, but all my values are in a multi dimed array.
But it contains all the information, plus all the null rows exc..
I would like to take this information and put it into a datatable, so I would not have to change much in the application.
FYI, in the excel file the 1st row is a headings row, and there can be duplicates but the duplicates I don't need to worry about. So in my datatable the first array elements would have to be columns, then move to the rows, and if its a duplicate I can skip it or just tack on an index number. Also the users can move the headers around so I cannot rely on R1C1.
Thanks for any help or advice on another way to approch this,
KSS
Ordinary Programmer
It's all done in a loop. Problem is this is taking a very long time to read through.
I found this line of code. Array Myvals = workSheet.UsedRange.Cells.Value2 as Array;
That works super fast, but all my values are in a multi dimed array.
But it contains all the information, plus all the null rows exc..
I would like to take this information and put it into a datatable, so I would not have to change much in the application.
FYI, in the excel file the 1st row is a headings row, and there can be duplicates but the duplicates I don't need to worry about. So in my datatable the first array elements would have to be columns, then move to the rows, and if its a duplicate I can skip it or just tack on an index number. Also the users can move the headers around so I cannot rely on R1C1.
Thanks for any help or advice on another way to approch this,
KSS
Ordinary Programmer