How to delete the columns in CSV file

Hi All,

I am downloading a csv file from a website after that while reading the CSV file I am getting an error like “Read CSV: A column named ‘Remarks’ already belongs to this DataTable.”

I want to delete the Remarks columns which is appear more than one time, please someone help me how can I delete the duplicate column??

@THIRU_NANI
@Nithinkrishna
@Palaniyappan
@ushu
@lakshman
@Gokul001
@rahulsharma
@Rahul_Unnikrishnan

one option of fixing it

  • renaming at the first text line the duplicated col names on string / text file level

another technique is to pass the text to generate datatable activity and tick off the setting that first line is header names. then remove the column from datatable by using the column index

I can rename the duplicate columns before downloading right??

elaborate more on the details what is done. It looks like parsing data and downloading is missmatched. Thanks for support

Hey @HeartCatcher

So you need to perform the following,

  1. Make sure there are no duplicate columns

  2. Read Range from CSV to Data Table

  3. Use Filter Data Table activity which will help you filter with conditions and also to keep or remove few columns from the table

Hope this helps

Thanks
#nK

Hi @HeartCatcher
we usually get this error when the column already exists in the datatable.
Kindly check all the columns of the datatable, there must be a duplicate value.

Hello @HeartCatcher Try the attached workflow

Example.zip (3.8 KB)

Hello @HeartCatcher

Here in your case the csv which you are reading is having multiple columns with the same name. Thats why you are getting this error.

So while reading the file, disable “Add header” in the property. Then after getting the datatable, use delete row activity to delete the first row in the datatable.

Thanks