How to get excel file headers into a variable?

Hi All,

Help me to solve this, I need to store all the excel files headers in to a variable

I tried but didn’t get

Assign = dtvariable.clone().tostring

Hi,

Which type output do you need? The following might help you.

String Array

arrColumnNames = dt.Columns.Cast(Of DataColumn).Select(Function(c) c.ColumnName).ToArray()

String (tab separated)

columnNames = String.Join(chr(9),dt.Columns.Cast(Of DataColumn).Select(Function(c) c.ColumnName))

Regards,

1 Like