How to use variables to build a Excel File

Hello!

I’m currently working on creating an automation using Excel Activities, but I’ve encountered some problems and I need your assistance.

My goal is to create an Excel file with specific headers, namely “Title” and “Import,” and populate each column header with information from two variables. However, I’m unsure about the correct approach.

So far, here’s what I have done: I “built a data table” with the two headers, and then used a “For Each Row” activity to iterate through the data table and “add data row”. Next, I included an “Excel Scope” activity where, for each excel row, I used an “write datatable to excel” activity to write the data table to the Excel file. Finally, I used the “Save Excel File As…” activity to save the file.

I would greatly appreciate your help with this matter! Thank you!

Hi @Carla_Munoz

The process done by you is right so can i know what is the exact problem.

1 Like

Hi @Carla_Munoz
1.Build a Data Table
2.For Each row in Data Table
3.In for each use Add Data Row activity to add variables
4.Outside for each use write range workbook activity

1 Like

@Carla_Munoz You told all the solution and now I am confuse where you are facing problem,
what is the exact place where you are facing issue.

1 Like

And what i need to put in “Add data row” activitie? Because then I don’t know where my problem is since you are all telling me that it is well done.

@Carla_Munoz
Give your variables

1 Like

@Carla_Munoz
If you have just variables then their is no need to put for loop outside “Add Data Row” activity
Just put add data row activity and assign in array section like this
{Var1,var2}

1 Like

Thank you!!!

Okaay! Thank you!! :blush:

@Carla_Munoz
Their is no need to make variable as well you can pass specific column values in Add DataRow activity
Like this
{CurrentRow(“YourColumn”).tostring, CurrentRow(“YourColumn”).tostring}

No need of variables

1 Like

Okay thank you!

1 Like

@Carla_Munoz anything else from our side.

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