How to paste excel data row by row?

dear,

after watching video of uploading data from Csv to web portal, I noticed that we need to loop the Csv file with “Write line” with expression of “row(“A”).ToString”

however, when I change Csv to Excel, the “Write line” function with same expression is invalid.

may I know if we need to change the expression ?? thanks

Hi @MichaelC it will work ,can you share your workflow?

thanks.

in Csv, we are using “Data1” as DataTable, but in excel, we need to use “dttable” as workbook application.
hence, I dunno how to convert workbook application into DataTable, i.e. “dttable” to “Data1”

as such, in “For each row” and “Write line”, I cannot read the excel output from “dttable”. thanks for your help in advance.

Main.xaml (20.0 KB)

Hey @MichaelC

By using Read CSV will return the output in datatable but with excel application scope it Opens an Excel Workbook and provides a scope for Excel Activities. When this Activity ends, the Workbook and the Excel application are closed. If a WorkbookApplication variable is provided in the Output > Workbook property field, the spreadsheet is not closed after the activity ends. If the specified file does not exist, a new Excel file is created. This activity can only be used if the Microsoft Excel application is installed on your machine.

to read its data you have to use “Read Range” activity from excel category. This activity will return its output as a datatable.

here you can use Data1 as a datatable same like csv and you have already done that in your workflow sample.

Regards…!!
Aksh

@MichaelC you can follow the same workflow as you used in retrieving data from CSV file ,by replacing Read CSV into Read Range activity.

thanks and I read through my process, it stored the “Data1” as data table by “read range”. However, when I run process, it pops up exception box

may I know exactly how to solve it? thanks ~

what you are using in writeline share here and are you using it inside for each or outside?
and please make sure to check the “Read Range” activity “Addheaders” property.

Regards…!!
Aksh

1 Like

it works, thanks!!

would you mind to share UI function on how to read column A data and determine which process to run thru? shall I use “If” or “switch” function? specifically, I will have “A, B, C,D” in column A2,A3,A4 and A5 and if UI read “B”, go to “B recorded process”, and etc.

thanks~

if you have more cases so better to use “Switch activity” or “Flow Switch”.

Regards…!!
Aksh

thanks~
for switch function, may I know if my expression is wrong??

“(string.Contains(“B”))”, then go to B flow
however, wt if I would like to go to A, C, D, E flow, how to write the expression and let “switch” function to go different flow??? thanks~

There is predefined Switch case activity available in UiPath, where you can define the cases and its respected flows as required.

For you , you can use “Flow Switch” Activity as well if getting problem with switch.

For Reference : What the Use Case for a Switch vs Flow Switch

Regards…!!
Aksh

1 Like

Hy!
I’ve got the same problem. I don’t know why my read range doesn’t work. Can you help me?
Thank you :slight_smile:

Share your error?

Regards…!!
Aksh

Hi
I have similar to do but need to create a New column Sr. No in excel that would print serial numbers upto 100. I am not able to get how to print number to excel row by row? Can anyone tell me please?

Regards,
Komal