Micro Focus QTP (UFT) Forums
Read column name of DataTable - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Read column name of DataTable (/Thread-Read-column-name-of-DataTable)



Read column name of DataTable - hajjf - 03-18-2008

Hi,

I want to be able to read any column's name into a DataTable.
I open many Excel files and each one of them has different contents - different number of columns and different column name's.

Can you help ?

Thanks.


RE: Read column name of DataTable - Cpt.Zack - 03-19-2008

I can help, but am finding it difficult to understand your question, try explaining once again.


RE: Read column name of DataTable - hajjf - 03-19-2008

Lets make it simple: I want to know the column's name (header) in the data table.
I open an Excel file and I want to know what are the column's headers it contains.
If I have one Excel file, I will be able to read it. The problem is I many different files. Each one has different fields.
One more thing, it's feasible using the Excel object. Unfortunately, I can't use it because the client doesn't have Excel installed (and doesn't want to install it)-:


RE: Read column name of DataTable - Cpt.Zack - 03-21-2008

I couldn't find a direct method.But, Have you thought about using an insanely large number as you max loop count and retrieving the cell data one by one? The loopcounter should be more than the number of coulmns in the excel sheet with the maximum number of columns.


RE: Read column name of DataTable - hajjf - 03-25-2008

No I did not try it. But now, I did change the way how to do it.
Thanks again for your help.