Checking if Column Name exists C#


Hi please advise, what am I doing wrong?
DT.Columns.Contains used to work with dates down to the specific format but now I’m confused as to what I have done wrong

Use the condition like this

it would work


Nived N
Happy Automation

Thanks for your response but I
still can’t detect it…
the format is actually “dd-MMM” so I don’t understand why it isnt picking anything up


Can you just select Preserve Format of read range activity and run it?

same result :frowning:

Hi @lmoham , below i am attaching the workflow and sample excel sheet, check this
Main.xaml (10.4 KB)
sample.xlsx (7.8 KB)

it is working fine


Nived N
Happy Automation

I don’t understand… why doesn’t mine work
Main.xaml (9.9 KB)
project.json (1.3 KB)
dummy.xlsx (8.5 KB)

Hi @lmoham

check this file

i had made the workflow according to the requirement
Main.xaml (11.7 KB)


Nived N
Happy Automation

1 Like

Hello again, I tried implementing the array into my main file but came up with errors is there a way to do it in C#?

I’m not familiar with the code you used for the array could you elaborate on dc, Cast and CDate?

Hi @lmoham
in c# u can use this to columnnames as array

(from dc in dt.Columns.Cast()
select ConvertToDateTime(dc.ColumnName).ToString(“dd-MMM”)).ToArray();

Got back these errors

Hi @lmoham
just edited my response , check above


got rid of most errors, decided to use a new datatable by the name of dates which only contains the column names

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