How to get the index of column where the column name is date?

Hello All,

I would like to know how to get the index of column where the column name is date?

Both below formula returns -1, kindly help


Hi @Anusuya_R ,

We would ask you to also Debug and check the Column Names of the Datatable in the immediate Panel.

Maybe the date column name being passed is in a different format than what is observed in Excel.


Could you instruct me how to do this?

In general the statements look ok at a quick look

set a breakpoint after excel is read in
debug and get paused
use immediate panel and type in: YourDataTableVar.Columns

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

now it can be checked on how the columns are named.

Feel free to share the result with us

1 Like

hi, below is the result i got.


So you can see that the Time part is also part of the Column Name. Was this adressed when checked the statements from above?

A quick dirty approach

myIndex =

YourDataTableVar.Columns.Cast(Of DataColumn).Where(Function (x) x.ColumnName.Trim.StartsWith("06/30/2023")).Select(Function (x) x.Ordinal).DefaultIfEmpty(-1).First()

try this