How to get Excel Header Names in One String to compare with other string

Hello team ,

I have values like ‘abc;def;ghi’ in one string (for eg - Str A) and
I have ‘abc’ , ‘def’, ‘ghi’ as header names in one excel file .
How to get the above header names in another string like - ‘abc;def;ghi’ (for eg - Str B)

I want to compare whether the excel headers matches with the given data
i.e Str A = Str B.

Please let me know if you have any easy way to do this

Regards,
Gokul

Hi @gokul1904 ,

You can use ReadRange Activity to read a particular sheet and the output will be stored in a datatable.

Use datatable.Columns method to get all the column names of that sheet.

Hi,

Can you try the following?

Let’s say dt is datatable from excel, strA="abc;def;ghi"

strA = String.Join(";",strA.Split(";"c).OrderBy(Function(s) s))

strB = String.Join(";",dt.Columns.Cast(Of DataColumn).Select(Function(c) c.ColumnName).OrderBy(Function(s) s))

Then check strA = strB

Regards,

Hi @Yoichi ,

Thank you for the response -
The “ColumnName” which you had mentioned to enter is not possible here since
‘abc’ , ‘def’ etc are header names in separate column -

Can you let me know how to fetch these headers in the below format -
“abc;def;ghi”

Regards,
Gokul

@gokul1904 Try the attached workflow

Example.zip (10.8 KB)

Output

Capture

Capture1

HI @gokul1904 ,
PFA xaml file , i have developed workflow as per your requirement.

hope it solves your issue.
Headers.xaml (10.8 KB)

Regards
P.S.Balasubramanian

1 Like

thanks alot!

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