March 20th, 2009, 05:57 AM
[RESOLVED] get Excel Worksheet names with SQL Query ??
I'm using the following code to retrieve data from uploaded Excel Spreadsheets, however the specs we got says "Worksheet named 'Sales' or something simular" .. The sample files we got have 3 names for the Same sheet, however they each start with 'Sale' .. Sales , Sale Totals, Sales Total ....
Now how can i query the Excel Speadsheet and get a list of Worksheet names, where i can the check and pass the correct name to the above code..
Dim oledbconn As New OleDbConnection
Dim oledbcmd As New OleDbCommand
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFilePath + ";Extended Properties=""Excel 8.0;IMEX=1;HDR=YES;"""
oledbconn.ConnectionString = strConn
oledbcmd.CommandType = CommandType.Text
oledbcmd.CommandText = "SELECT * FROM [Sales$]"
BTW. I need to do the same for another worksheet in the same file....
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!