Skip to main content
Solved

I need a dataTable and create rows one by one in order. Whats the correct way?

  • November 24, 2025
  • 8 replies
  • 58 views

Forum|alt.badge.img+12

I assign a DataTable variable, as 1*1, then delete row 0 and column 0 to create the datatable from zero.(one by one)

While adding column , i also set value of single cell in the related column.

In total i am having 10 columns.

Then when i need to “add row” action in dataTable again, it shows me error, and says “the schema is size of the row to be entered is different from the table.”

Im guessing its indicating the data table which i first created as 1*1.

But i add columns later.
and then i need to enter a row, and fill the datatable rows based on the column name.

How can I do this?

Best answer by Aaron.Gleason

Then… ​@Semih 3318... 

You will need to pre-configure your Data Table variable with 1 row and 10 columns. You will need to configure all 10 columns with the appropriate data type (e.g., String).

Once you have that, you will need to create a Record variable and pre-configure the Record variable in the same way as the Data Table variable -- all 10 columns.

In the Automation itself, use the Data Table: Clear content action to get rid of the row you pre-allocated.

Next, use 10 Record: Update value actions to set each of the 10 columns of the Record variable. 

Then, use a Data Table: Add row to add the contents of the Record variable to the Data Table.

Finally, after you’ve added all your rows, you can use an Excel Advanced: Write from Data Table action to write the Data Table to Excel. By the way, this changes your cell values to all strings.

You can do it, but I think you might be able to see that it’s the wrong tool for the job.

8 replies

Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • November 24, 2025

@Semih 3318 The first thing to ask is “why are you using a Data Table?” You might be using the wrong tool for the job. Data Tables, being in memory, make it difficult to visualize what you’re building, making it difficult for debugging.

When using a Data Table, you need to match the column organization of the Record variable you’re using to add rows. What you might be trying to do is to clear the contents of the Data Table variable and then adding a row with the values from the Record variable.

If your end-game is to write data to an Excel file, consider using the Excel *: Set Cell and Excel *: Go To Cell actions instead. This way you can easily visualize and debug your automation because you can watch the cells being written. It’s slower, a bit. It’s many more actions, yes. But it’s worth it when you’re trying to debug an issue.


Forum|alt.badge.img+12
  • Author
  • Pathfinder Advocate | Tier 6
  • November 24, 2025

@Aaron.Gleason i need to get some rows and columns as table, then ill put it in excel file to show which rows and columns robot complete succussfully, which doesnt complete and whats the reason.

 

So my table will be result of comments of row/column, which is succesful or not, as explanation.
 

Instead of having a record variable and add it as row , how can I create an empty datatable, and fill the table one by one?

Actually I just dont know how to fill a record variable for 10 columns. 

In record action, there is Record:Assign but i dont know if its right one to use for me
I need to have a record variable like r1, r2,...r10, then get is as main Record variable i guess


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • November 24, 2025

@Semih 3318 Yep, wrong tool for the job. Data Tables DO work for that, but I’ve seen many, many people mess up with their output by not working with the Data Table correctly, and not seeing it when writing the Data Table to the Excel file.

Because you don’t know how to set a value to a Record variable, I STRONGLY advise using the Excel Advanced: Set cell and Go to Cell actions.

Here’s a very simple example, and you can see how it is moving the “Active Cell” (that is, the highlighted cell in Excel) exactly where you want it. 

Here’s a link to a video in action:

https://axyz.us/downloads/setcellgotocell.mp4 

You’re going to end up with MORE actions trying to do the same thing with a Data Table variable.


Forum|alt.badge.img+12
  • Author
  • Pathfinder Advocate | Tier 6
  • November 24, 2025

@Aaron.Gleason thank you for your reply. But i may have many rows with 10 columns. Thats why i find datatable fast and really fun to debug actually.. I would like to do this with datatable variable, and also i am trying to get more experience with it. 


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • Answer
  • November 24, 2025

Then… ​@Semih 3318... 

You will need to pre-configure your Data Table variable with 1 row and 10 columns. You will need to configure all 10 columns with the appropriate data type (e.g., String).

Once you have that, you will need to create a Record variable and pre-configure the Record variable in the same way as the Data Table variable -- all 10 columns.

In the Automation itself, use the Data Table: Clear content action to get rid of the row you pre-allocated.

Next, use 10 Record: Update value actions to set each of the 10 columns of the Record variable. 

Then, use a Data Table: Add row to add the contents of the Record variable to the Data Table.

Finally, after you’ve added all your rows, you can use an Excel Advanced: Write from Data Table action to write the Data Table to Excel. By the way, this changes your cell values to all strings.

You can do it, but I think you might be able to see that it’s the wrong tool for the job.


Forum|alt.badge.img+12
  • Author
  • Pathfinder Advocate | Tier 6
  • November 24, 2025

@Aaron.Gleason  thanks Aaron. I am able to do it now. It works great. As you told i have created a datatable 1row*10columns

In the loop i created same column names with my datatable variable, using record:add column
And i added record:update column to give them their value.

Since i created all the columns in the first loop action, i didnt need to add record column, also it was giving error if i tried to create same named column, end of each loop i added record variable into datatable using dataTable - add row action.
so i just continued to update the record column values
Finally, i created my datatable variable, and wrote it into excel file


Forum|alt.badge.img+2
  • Cadet | Tier 2
  • November 25, 2025

@Semih 3318 - Are you needing to update columns one at a time or or you adding one full row of data to the table at time?  If adding one full row at a time, depending on the structure of your data,  you could easily create a csv file by using the log to file action.  Start by logging to file the column names separated by commas, then log to file each row of data as needed, with the data also separated by commas.


Forum|alt.badge.img+12
  • Author
  • Pathfinder Advocate | Tier 6
  • November 25, 2025

@PMosman first i created a datatable. Then in first loop i create columns, and its values one by one.

i assigned those values into a record variable, adding its column name and column value.

But that is not enough, because i need to add more rows, so i need more record values.

Since i created columns in the record variable. Instead of creating a new record variable, i just updated the record variable.

End of the loop (inside loop) i added this record variable into datatable, using dataTable-add row action.

 

I think your way would also work though. Thank you :)