Is it possible to declare the number of rows for a datatable, if so how is it done?

I want to create at datatable with 1M rows, I want to know if it can be done like a declaration statement simlar to defining a 2d array in any other programming languages , eg a[10][100].

Hi @PriyaRK,

I am not sure if we can have a fixed number of rows for a datatable when you create one, as you said life for array,
you can create a new datatable and add as many rows you want to that table and I am not sure why you want fixed number of rows to the datatable.
Can you explain the reason, So that we can try solving in best way.

Pavan H

Hi Pavan,

I have a data table having 61 columns and about more than 2 Lakh entries and i want to assign a default NULL value into the datatable .The input entries for this table is a little inconsistent meaning there aren’t 61 values to be entered, there may be 4 to 61 valid entries that should be added in to final table, the rest of this should be kept null.


The DataTable type is basically an enumerable of rows that has no fixed upper bound. Meaning you can add a row to it as much as you want.

Typically, you will initialize your DataTable by using a Read Range or Read CSV and store the data from a file to this table. Then, using a For each loop, you can perform actions on each row of data.

The other use for DataTable, would be to start with an empty table, then using the Add Data Row activity, you can add rows of data as you perform actions on them.

I hope this is the answer you were looking for.


1 Like

Hi Clayton,

In My use case I have started with an empty data table, the rows are getting added, I am not sure if the data is getting assigned correctly, I end up having only one row of data when i try to write it in an excel sheet.
I am not sure where I am going wrong.


@PriyaRK I think you are not using counter variable in write cell so its updating for same row at each time


It would be helpful to see your code, cause there could be a mistake. If you reset the datatable back to an empty table before adding a new row, this could result in only one row. However, if you only set the datatable one time, then simply using Add Data Row will continue to add your data to the datatable as intended - no counters needed.

Hi @ClaytonM,

I will check it for mistakes once and let you know.