Hi Guys,
I want to add new column to the existing Excel workbook - now the column header will always contains previous month & current year, for example in this month => 82021 but here is one condition: if that column header is already there, do not add anything.
So I’m looking for some kind of Excel HLookUp but I didn’t find anything in the UiPath - I’m not sure how I can check the first row data, to avoid having duplicated columns names like on below screen:
Thank you for your support but the condition you gave was not working as it should - it was adding the column even if it was already presented in the file - it throw an error after adding duplicated column but this wasn’t the effect I’d like to achieve.
However I’ve found another workaround to this problem with a for each loop as below:
Loop:
For each item in dtMyTable.Columns:
If: item.ToString = cint(strTargetDate).ToString
boolColumnExists = True
Break
Now after all columns have been checked, there is final If statement to check bool variable and add column if needed:
If: boolColumnExists = False
Add Data Column
Write Range
And the above is working as of today.
Have o good afternoon,
Piotr