I have an Excel spreadsheet that will be hosted on a network drive. It should access my Winforms C # 3.0 application (many users can use the application and click on this table at the same time). There is a lot of data on one sheet. This data is divided into areas that I called ranges. I need to have access to these ranges individually, return each range as a dataset, and then snap it to the grid.
I found examples that use OLE and made them work. However, I saw some warnings about using this method, plus at work we used Microsoft.Office.Interop.Excel as a standard so far. I really do not want to deviate from it, unless I have to. As far as I know, our users will use Office 2003.
I can get the range I need with the following code:
MyDataRange = (Microsoft.Office.Interop.Excel.Range)
MyWorkSheet.get_Range("MyExcelRange", Type.Missing);
The OLE path has been enjoyable since it took my first row and turned it into columns. My ranges (12 in total) for the most part differ from each other in the number of columns. I did not know if this information would affect any recommendations.
Is it possible to use Interop and return the returned range back to the dataset?