How to add column name if that name is not present in the downloaded excel file from application

Hi

how to add column name if that column name is not present in the downloaded excel file from application.

Thanks
Likitha

Hi @vinjam_likitha ,

Could you provide us with some more details as to what issue you are facing ?

Do you not have any of the column names present after the Excel file is downloaded. Do you know the column names to be added to it ? Will the column values will always be in the same format meaning in the same order ?

If so, then we should be able to add a new row at the beginning of the Excel file with the column names in the order required.

Let us know if this is what was required.

Hi @vinjam_likitha

You can see my below Sequence, Take if Condition and pass this Query in that YourDTname.Columns.Contains(“Column_Name”). If Condition is True you dont need to add Column name else using “Add Data Column” activity you can add the Column in your Data Table.

Hope this helps,
Best regards.

Hi @vinjam_likitha - Try below steps

  • Read excel to data table
  • Use below exp in assign activity
Variable of type boolean output = DT.Columns.Contains("Name")
  • It retruns True or False
  • if True, then do nothing, else, you can insert the column using excel activites

Hi

in the next step,after adding the column Name “Aptus_Config2_Componentid_r.product” to the datatable i have to change the column name from above one to “Option”

eventhough i have assigned Option to that column.it is dispalying Column1 instead of option.Below is the output

image

in the column1 place i need Option

Thanks in advance
Likitha

Hi @vinjam_likitha ,

You would have to write the modified data table back to the excel to see the changes in excel.

Regards,

Hi,

First i will export excel from Application.
Second i have to check whether that column “Aptus_Config2_Componentid_r.product” present in it
if it is not present i have to add that column in that excel.
then i have to change the name of the the column from “Aptus_Config2_Componentid_r.product” to “Option”

Based on this Option column i have to Lookup the same data in another excel file

Thanks
likitha

Thanks
Likitha

Just column Names i have to add and change

Thanks

Hi @vinjam_likitha

Use this Query if you want to assign “Option” to change column name.
Your_DTName.Columns(“Aptus_Config2_Componentid_r.product”).ColumnName

hopefully this will change your column name.