I'm using ADO objects to query an Excel spreadsheet. As part of this project, I need to get a list of all the column names except the first in a certain sheet. I do that by executing a "Select * from [the_worksheet$]" and the following code:
The "Select" statement works fine, but I've noticed the following weird behavior:
The worksheet has three columns with header rows; let's name them col1, col2, and col3. I expect this code to only output "col2" and "col3", which it does when I have the worksheet open in Excel at the same time. However, when I don't, it outputs "col2", "col3", "F4", "F5", "F6", "F7".
Does anybody know where the extra columns came from?
Thanks.
Code:
Set rs=myConn.Execute("Select * from [the_worksheet$]")
For x=1 to rs.Fields.Count
Response.Write(rs(x).Name)
Next x
The "Select" statement works fine, but I've noticed the following weird behavior:
The worksheet has three columns with header rows; let's name them col1, col2, and col3. I expect this code to only output "col2" and "col3", which it does when I have the worksheet open in Excel at the same time. However, when I don't, it outputs "col2", "col3", "F4", "F5", "F6", "F7".
Does anybody know where the extra columns came from?
Thanks.