By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

How to get the name of the Excel Sheet?

P: 24
I'm using this classic ASP code to get the data of the Excel Sheet named Sheet1:
Expand|Select|Wrap|Line Numbers
  1. Set conn = Server.CreateObject("ADODB.Connection")
  2. conn.Provider = "Microsoft.ACE.OLEDB.12.0"
  3. conn.Properties("Extended Properties").Value = "Excel 12.0"
  4. conn.Open Server.MapPath("uploads\my_excel.xlsx")
  5.  
  6. sql1 = "SELECT * FROM [Sheet1$]"
  7. set rs1 = conn.execute(sql1)
  8.  
So, the Excel sheet must be named Sheet1. But in my application, the user can upload the Excel sheet, so I don't know the sheet name. What I need is how to get the sheet name using my code automatically or how to get the names of the available sheets in the Excel document.

Thanks alot in advance.
Mar 28 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.