Save data in excel

Hello everyone, I know my question is very simple, but I’m starting in RPA.
How do I save four string variables one in each column with their header. For example: I want to put the contents of the variable Name in a column with NAME header. A content of the code variable in the CODE column?

Hello @maurovmorais

Welcome.

You can build a datatable with Build Datatable Activity and create as many columns as you can.

Then you can insert data directly into table from UI or if it is dynamic you can save them in variable and the use Add Datarow activity and add to datatable.

Once you do this you have datatable with desired data, you can you Excel application scope with write range activity or write range activity of workbook.

All the best

Thanks,
Prankur

1 Like

Example: Build a datatable or read an excel sheet as a datatable
Datatable name: dt
Datatable consists of 4 columns (“Name, Age, City, Salary”)
If you want the value of the 4th row in the 2nd column,to be filled in you should use one of the following “assign activities”:
►dt.rows(3).Item(“Age”).tostring = Str_variable1
►dt.rows(3).Item(1).tostring = str_variable1

Important: The indexes start counting at “0”, which is the first row or column. That is the reason why you need to indicate index 3 for the 4th row or 4th column.

Afterwards if you want it in excel you have to use the activity “write range” and write the dt (don’t forget to check “add headers” if you want to include the headers")

Hope this helps.

2 Likes

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