I’m new to UiPath. Is there any example steps to show how should I read the data from specified column and calculated it, then display it as column in another excel?
For example. I have an excel file with 4 columns.
I wanted to read the data from column ShippingFees and Tax Amount. After retrieved, I want to do a calculation, save it in another excel. How can I achieve that?
Step1: Use ReadRange activity to read your excel into Datatable.
Step2: Use build data table activity to build the datatable with required columns.
Step3: Use For each row as datatable and pass your datatable activity.
Step4: Inside for each use assign activity and assign the required values to a variable as
VariableName(Left) = Row(“YourColumnName”)
Step5 : Use Add data row activity
Step6: At last you can use write range activity to write the data to the new excel.
Or
You can do it by using linq as well if you want let me know I will post that solution as well
—read the excel with excel application scope and pass the file path as input and get the output with a variable of type datatable named dt
—then use a assign activity like this
FinalDt is a datatable variable defined in Variable panel with default value as
New system.Data.Datatable
Now Finaldt will have only the two columns which you can iterate now with FOR EACH ROW ACTIVITY and perform calculation and move it to another excel with write range activity
Thanks for the solution, it works for me too!
But I have one question on this finaldt = dt.DefaultView.ToTable(False,”Shipping Fee”,”Tax Amount”)
Is this similar to Build Data Table?