Unable to extract output of Uipath

I have got an input in a CSV file ( not Excel ) which I have got into a sequence through read CSV and achieved an output (output panel) but I am not sure how to add these output into CSV (not Excel) as an additional column.

If I am doing a write CSV activity then it is picking only the last row but I am looking to add a column to my CSV (notepad) which will have all the records available in output

Hi @dipon1112000
First Extract Data
the Extract Activity- See Property And Output Create Variable On DataTable
Write Range In Workbook To Wite Data Table in Excel
see like that
image

And
image

Simple

Thanks in advance,
Darshit

Hi @dipon1112000

Try the below process:
=>Use Read CSV to red the file and store the output in a datatable.
Input:


=> Use Build Data Table activity to write the columns.
Build DataTable:

=> Use For Each row in DataTable to iterate through each row and give the below syntax in assign activity:

Number1= CDbl(CurrentRow("column3").ToString)
Number2= CDbl(CurrentRow("Column5").ToString)
Output= (Number1/Number2).ToString

Note: Number1 and Number2 are of DataType System.Double. Output is of DataType System.String
=> Use Add Data Row to add the rows to the datatable.
=> Use Write CSV to write the Datatable back to excel.
Output:

Workflow:


xaml:
Sequence9.xaml (13.6 KB)

Hope it helps!!
Regards

Thanks but I do not have Excel and cannot use Excel, so will I be able to get the data if I give the path to notepad

@dipon1112000

First of all you want to add a column or row?

If column then read data and use add column then write data back

If row then read data then add data row and then write back

Cheers


This is an error I am getting

Hi @dipon1112000

Please check the solution I have provided above.

Regards


Thanks for your help, I have followed the same steps but not sure y I am getting this error

Hi @dipon1112000

Give the below syntax in Add Data Row:

{CurrentRow(0).ToString,CurrentRow(1).ToString,CurrentRow(2).ToString,CurrentRow(3).ToString,CurrentRow(4).ToString, Output}

Pass the same syntax.

Regards

Thank you but now I am getting another error

@dipon1112000

Could you share the screenshots of whole process. or Send the workflow file.

Regards


This is my datatable

This is my input CSV

This is multiassign

Hi @dipon1112000

You haven’t give the output for Build Data Table. Give the below way by creating a variable out_dt.


Pass the datatable in Add Data Row activity i.e., out_dt:

In Write CSV pass the same datatable out_dt.

Regards

Thank the fraction is showing in output but it’s not getting added to the output file

Only first 2 columns are getting transferred but remaining 4 columns are not

@dipon1112000

Where do you want to write the output is it in a CSV file or a Notepad file. Specify.

Regards

Notepad.csv as I I do not have Excel that 8sbthe reason I am picking input from notepad.csv and I am supposed to get output to notepad.csv

Hi @dipon1112000
Try the below process:
=>Use Read CSV to red the file and store the output in a datatable.
Input:


=> Use Build Data Table activity to write the columns.
Build DataTable:

=> Use For Each row in DataTable to iterate through each row and give the below syntax in assign activity:

Number1= CDbl(CurrentRow("column3").ToString)
Number2= CDbl(CurrentRow("Column5").ToString)
Output= (Number1/Number2).ToString

Note: Number1 and Number2 are of DataType System.Double. Output is of DataType System.String
=> Use Add Data Row to add the rows to the datatable.

{CurrentRow(0).ToString,CurrentRow(1).ToString,CurrentRow(2).ToString,CurrentRow(3).ToString,CurrentRow(4).ToString, Output}

=> Use Write CSV to write the Datatable back to excel.
Output:


Workflow:

zip file:
FOrum CSV Task.zip (48.6 KB)

Please do un-zip the file and delete Forum CSV Output and run the process. This will work for you.

Regards,

Thank you you nailed it :grin:

Last thing can’t we make the output fraction small

Ex suppose after division if we are getting output as 123.56789 to 124

1 Like

Hi @dipon1112000

If you want to make the output fraction small you can try the below two ways:. Pass any one of the syntax in the Output variable.

1st Way:

Output= Math.Ceiling((Number1/Number2)).ToString

Output:

2nd Way:

Output= Math.Round((Number1/Number2)).ToString

3rd way:

Output= ((Number1/Number2)).ToString("F2")

Pass any one of the three syntaxes in Output variable assign activity inside For Each row in DataTable. I think first syntax will help you the most in meeting your requirement.

Regards