Thanks both of you. If we cannot determine if a column is hidden through OLEDB, it would not work for me.
The Excel I'm working with is actually a very complicated Excel application with sheet protection. I cannot un-hide those hidden columns. Neither can I see the name of those columns. What makes it worse, the data in the worksheet is not even strictly column based.
I'm going to close this case. Thank you guys. I really appreciate your efforts.
I was going to post a similar solution to starlite but I wondered if it would work for you because of needing to name the columns.
I didn't get round to try anything which would work without knowing the names, but now that you've mentioned all these other things I don't think that's going to work either.
Can you even use OLEDB with a protected worksheet?
Yes, I can use OLEDB against a protected worksheet. Since the column names are unknown, OLEDB parses them as F1, F2, F3 and etc. In my case, the thing is the Excel uses Macro, the column with the data I want may not be the same column the next time when data in another worksheet is changed.
No, there is no way you can get a "fixed" column name. The content on the worksheet is dependent on the input on another worksheet and the process is automatically controlled by Macro.
What *is* fixed is a pattern of the display of the data. However in order to make the pattern work, I need to ignore the hidden columns in that worksheet. Unfortunately, OLEDB cannot do that.
Although the data is not column-based, OLEDB can still take everything out as text.
Microsoft Excel
Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.
ASKER
I'm getting data from Excel to a DataTable Component. Thanks.