LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to retrieve the activesheet of an Excel file using OleDbConnec

I need to retrieve the the active worksheet of an Excel file using
OleDbConnection.

With the following code, I can retrieve the list worksheets, but I can't
find a way to get to the active one.

string sExcelFileName = @"c:\excelfiles\ExcelFile.xls";
string sConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ sExcelFileName + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1;\"";
OleDbConnection ExcelConnection = new OleDbConnection(sConnectionString);
ExcelConnection.Open();
DataTable excelDataTable =
ExcelConnection.GetOleDbSchemaTable(OleDbSchemaGui d.Tables, new object[]
{null, null});
foreach (DataRow row in excelDataTable.Rows)
{
string sWorksheetName = row["TABLE_NAME"].ToString();
MessageBox.Show(sWorksheetName);
}
ExcelConnection.Close();


More generally, I need to access the content of the active worksheet of an
excel file submitted to an ASP .NET web application.
Any way of doing it without using directly server-side automation of Office?

Thanks

--
leob
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I retrieve data from zip file into excel? Eric Excel Discussion (Misc queries) 5 November 26th 07 09:07 PM
How can I retrieve a deleted excel file? jenmun13 Excel Discussion (Misc queries) 3 August 3rd 06 12:39 PM
how do i retrieve a deleted Excel file aquaman Excel Discussion (Misc queries) 2 June 14th 06 03:53 PM
how to retrieve a deleted file in excel cgg Excel Discussion (Misc queries) 2 April 6th 05 05:58 PM
How do I retrieve a deleted file of Excel [email protected] Excel Worksheet Functions 1 January 28th 05 04:28 PM


All times are GMT +1. The time now is 09:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"