Adding string to a particular column in csv file

I have one downloaded csv file. in that we need to add client number in ‘A’ column thought out all the rows.
I have used these activities

  1. read csv
    2.for each row
    3.assign activity
    4.Add Data row

After these while write to csv. i’m getting only ‘A’ column values not other values.But i need all the values.
Suggest me how to achieve this

@sindhura506

Could you please share your workflow file and will help you.

Hi @sindhura506

I assume you already have a column to have the client number
Use the below steps:

  1. use Read CSV to read the data to a data table

  2. Use a For Each Row activity to loop through the values in the datatable

  3. Add an assign activity within the loop

  4. use the following expression to assign the value to the datatable column

    row("ColumnName") = ClientNumberVariable

This will assign the number to all the rows.

Is that what you need?

This the flow


This is my excel file. i want to add client number variable in column ‘A’

Yes, that is what i’m doing. But after assign the number i’m writing the Data table to csv file.while writing to csv old data table is coming. newly added data row is not affected.
I need 1st column modified data with old columns data.

@sindhura506

Can i see a screenshot of your worlflow?

@Lahiru.Fernando
This is the Flow what i did


This is the CSV file i’m working

Hi @sindhura506

So you are adding a data row to another data table here right? But you are using the same datatable variable that was used to read the csv file to write to the excel.

You should use the datatable associated with the add data row activity to write the data to excel.

Let know whether it helps

Oh hang on… that datatable should also work… because you are assigning it… hmmm… check whether actually a value is getting assigned there. Debug mode will help to understand that. Add a break point there and check the data

@Lahiru.Fernando
adding row.Item(0) assigning the value.but the problem it is considering all columns in row as single cell

Hi @sindhura506

Try assigning like this
row("ColumnName") = YourValueVariable

@Lahiru.Fernando
I don’t have column name so, i have used column index but unable to get the all columns.

Hi @sindhura506

Can you share your workflow so that I can have a look? also the excel file if possible

i’m unable to send the CSV file to you.

zip the two files and attach it :slight_smile: