Hello
I need to develope an application that will call each tab in my Excel spreadsheet...1 at a time and read data from rows/columns
Example:
Sheet1 is called and data is read from the Sheet1 into Visual Studio
Next call Sheet2 and data is read from the Sheet2 into Visual Studio
Next call Sheet3 and data is read from the Sheet3 into Visual Studio .....and so on
thanks
J
Loading
j lPosted Feb 26, 2010, 4:42 PM
Make sure you Include References:
Add the Excel Interop Reference Library in your project , AND also include the statement .......using Microsoft.Office.Interop.Excel;
Define Excel Object :
Microsoft.Office.Interop.Excel._Application ExcelApp = new Microsoft.Office.Interop.Excel.Application();
Open WorkBook and Call your Tab:
string myPath = @"C:\Excel.xls";
ExcelApp.Workbooks.Open(myPath);
ExcelApp.Worksheets["MyTAB"].Select();
Amit ChoudharyPosted Feb 22, 2010, 1:34 AM
I have attach the project download it and see how it works.
if you have Excel-07 format of Sheets then you have to change the ConnectionString to below:
string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" +
@"Data Source=" + Server.MapPath("~/App_Data/PhraseContentFiles/" + filename + "") + ";" +
"Extended Properties=\"Excel 12.0;HDR=YES\";";
All the Best.
Please don't forget to mark the answer.
j lPosted Feb 19, 2010, 10:51 AM
J
Amit ChoudharyPosted Feb 19, 2010, 10:43 AM
i can help you but you have to wait for some time i have done this before accessing sheets of excel seperately and modifying column.
wait for some time i'll come up with a solution for you.