Extra columns getting added by the name "Column1" with the "Actual Column Name"

Hey guys am trying to automate a process, in which I have to read files from a txt doc and write and store it in a datatable. And there are 7 columns in it and if the txt file does not contain those 3 columns out of 7 we must add the column in the datatable. However am able to add the column names but am getting extra columns “Column1” ,“Column2”, “Column3” . along with the actual column name.
input txt- this is when I manually remove the 3 column names

- expected output
- actual output

Also, please let me know what exactly happened,and why those unwanted columns were added

Hi

Welcome back to uipath forum

This will come if there is any blank space instead of text in those txt file

Check once with the input file you receive and try to standardise it

Or

If that cannot be standardised then we can later remove those columns alone with Remove Datacolumn activity

Cheers @praneet.naik26

Yes there is a space after the pipe symbol then the column name and then space and then again pipe symbol. What should i do?

1 Like

And will there be a same issue when trying to filter values like adding values in status, reason and salary columns

Hi @praneet.naik26,

If you cannot configure your txt file, I recommend deleting all added columns. The easy way to do this would be to use the filter activity.If there are certain columns you want, you can keep only them by selecting the keep field as below.

image

Regards,
MY

@praneet.naik26

Can you share the screenshot of how you are adding the columns to the data table

Fine there are two ways to handle this either

  1. We need to standardise as said earlier the CSV File and try to avoid blank column or fields

  2. Or if that can’t be done then read the csv and then remove it with expression where it removes blank columns
    Refer this for more details

Cheers @praneet.naik26

1 Like

Am using add column activity, I want to check if the 3 columns are present if not then am adding 3 add column activities.

I,ll try this

1 Like

Can I give a range of columns to be deleted in column index of Remove datacolumn activity
acitvity

1 Like

Remove data column doesn’t take range of columns in it

If you want to remove two data columns then use two remove datacolumn activity with the column names

But we can use DefaultView in that case

Have a view on this thread for more details on datatable functions

Cheers @praneet.naik26

Thanks for help used remove data column activity.

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