Hi guys (1st time poster here)
I am using Visual Studio 2008 and Microsoft Office 2007.
To start off simple, I want read and extract data from a specific cell in a excel worksheet using c# in visual studio as a class program.
So for example, in a already created spreadsheet (located in a specific directory), the number 100 is in the cell A1 (in sheet1). I want to read cell A1 using c# in VS2008 and add it into an array as a string (I know it is only 1 value but it will build up to make a full array) so the array includes the string "100".
As much help as possible is appreciated, and also help with what references to use; adding references i.e. using Excel = Microsoft.Office.Interop.Excel;
Thanks.
Arfan DhillonPosted Sep 24, 2009, 5:57 AM
Thanks for your replies so far, but how does the program read the file (does the file have to be open).
I am happy with the references, but struggling to use the definitions within the references and reading a specific excel file and returning at least 1 value. I've done a lot of googling and have found to many different solutions that are not quite as simple as I need.
I appreciate you helping a noob like me :)
Master BillaPosted Sep 23, 2009, 12:09 PM
here a article about this
thank you
Nir BarPosted Sep 23, 2009, 5:26 AM
-
-
-

Now the (pseudo) code should go something like:Add the Excel assembly as a reference to the project: Right-click on the project, select Add Reference.
Click the COM tab of the Add Reference dialog box, and find Microsoft Excel 11 Object Library.
Double-click on Microsoft Excel 11 Object Library, and press OK.
Please mark this as an answer if it helps you
Nir