Write CSV activity issue

Hi All,

My data is getting updated in correct row & column of CSV file. but i am also getting some extra columns attached in CSV. can you please suggest on this also. i am facing this issue after writing the CSV . values in CSV headers (column1, column2, column3…) i dont know from where this columns are coming

image

hi @priyankamalusare ,

column1, column2, column3… Comes when you Read the Data ina DataTable Without Headers.

If your Data is having Headers - Make sure to check Add Header property while reading Data in DataTable and While Writing to Csv - Check the option Include Headers in property of write csv


Mukesh

Hello ,

while read CSV & write CSV i have checked the “add headers” property already . still i am getting this extra rows
image
image

hi @priyankamalusare,

Between these 2 activites can you please have an writeLine and type var_PR_num.Columns.Count.Tostring to verify from where we are getting the extar Columns.

The column count should be 7 .

If more than 7 - that means - while reading from Source excel - we are getting extra columns.


Mukesh

Hello,

Yes i am getting extra columns when i am writing the CSV.

image

Can you tell me how to avoid this. i am capturing status & immediately in next line writing in CSV

hi @priyankamalusare,

Below are the things we can verify here.

  1. The csv you are writing the Data does is not having these extra Columns . You can do one thing here , take a sample Blank csv and try to write Data in it. This will Let us know wether there is Issue with File.

  2. If Still we continue to get the extra columns , we can have a Logic to delete the extra COlumns . Assuming the Extra columns are not part of DataTable and are of Csv File. we will write Code to remove extra Columns from CSV.


Mukesh

Hi dear,

My actual CSV from where i am reading data have only 7 columns.
i am taking data from browser against the ID and writing data in same CSV file.

Flow
1)Read data from CSV
2)foreach loop
3)write data in same CSV (same datatable using)

the bug is only getting some extra blank columns in CSV

@priyankamalusare,

image

we can have Flow like This before writing csv , we are telling uipath to verify the Number of columns in DT.

If More than 7 - Keep First 7 Rows - Using Filter DataTabale activity as shown below.

image


Mukesh

2 Likes

Thank you so much :slight_smile: it worked .

1 Like

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