First of all, it's important to know what you mind withmean by "open a excelan Excel file for readreading and copy it to clipboard ...".
This is very important because there are many ways you could do that depending just on what you intend to do. Let me explain:
- if you want to read a set of data and copy that in the clipboard and you know the data format (eg. column names), I suggest to use a OleDbConnection to open the file, this because you can treat the xls file content as a Database Table, so you can read data with SQL instruction and treat the data as you want
If you want to read a set of data and copy that in the clipboard and you know the data format (e.g. column names), I suggest you use an OleDbConnection to open the file, this way you can treat the xls file content as a Database Table, so you can read data with SQL instruction and treat the data as you want.
- if you want to do operations on the data by the Excel object model then open it in the way you began.
If you want to do operations on the data with the Excel object model then open it in the way you began.
- Some time it's possible to treat an xls file as a kind of csv file.., there are tools like File Helpers which permit to treat and open an xls file in a simple way mapping a structure on an arbitrary object
Some time it's possible to treat an xls file as a kind of csv file, there are tools like File Helpers which permit you to treat and open an xls file in a simple way by mapping a structure on an arbitrary object.
anotherAnother important point is in which Excel version the file is..
I have, unfortunately I say, a strong experience with working with Office automation in all the ways, even if bounded in concepts like Application Automation, Data Management and Plugins, and generally I don't suggest (excuseme I don't know the exactly word!), or better, I suggestonly as the last wayresort, to using Excel automation or Office automation in general to read data,data; just if there aren't better ways to accomplish that task.
Working with automation could be heavy in performance, in terms of resource cost, could involve in other issues related for example to security and more, and last but not at least, working with COM interop it's not so "free".. So my suggestion is think and analyze the situation within your needs and then take the better way.
Sorry for my poor english