Cant Find Filtered Excel Headers in DataTable

Hello,

Basically I have an Excel with column headers that have the filter function enabled so that the Excel can be sorted and viewed more easily.

I’m using the Excel application scope to import the excel into a DataTable with the read range and then trying to get a value from one of the columns. However I can’t seem to get the right header name to use because the program always crashes with (Column “header name” does not belong to DataTable)

Here is the Column for example I’m trying to get in the Excel/Datatable (“Document Date” for example)

image

and here is what I am using to try and get the value

Dt.Rows(0).Item(“DOCUMENT DATE DD.MM.YYYY Date(10)”).ToString

I can get the values from column headers that do not have the filter function enabled so I’m wondering what can I do to be able to make the filtered column headers work? Any help is appreciated thanks!

did you try using inside for each loop ?
if so you can get particular column values like this row(“DOCUMENT DATE DD.MM.YYYY Date(10)”).ToString

do one thing write in excel once and check how the header is actually coming based on that you can do further process!

Thank you! I am so stupid I was trying this but I’ve never realized until now that each column header has a few extra spaces between words so that’s why I couldn’t find them! sorry for the bother!

1 Like

not a problem,Always here to help
cheers
@kahoyim happy learning

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.