Hello,
I'm importing data from an excel spreadsheet into an ASP.NET web page. The problem is the sheet name keeps changing. It's always the first sheet in the excel book - but the users change the name.
Is there a generic name for the first sheet in Excel. So if the user names the sheet to "employees" - when I make a connection can I use something like [Sheet(0)]?
Using ASP.NET 4.0 and xlsx file.
Here's my typical connection: (Source name not complete path here.)
In Web.config
<add name="csXLMembers" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=...\Members.xlsx;Extended Properties=Excel 12.0"/>
Code Behind aspx Page
Dim conString As String = ConfigurationManager.ConnectionStrings("csXLMembers").ConnectionString
**** The following line is where I want to use a generic name instead of Sheet1$
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM [Sheet1$]", con)
JS
string sheetName = dtExcelSchema.Rows[0]["TAB
source: http://aspsnippets.com/Articles/Read-and-Import-Excel-Sheet-using-ADO.Net-and-C.aspx