Get all cells between D3-D6 and to the right of undetermined number of columns

Hi there,
I am trying to read all values from D4 to D6 and any populated columns to the right of cells D4-D6. Number of columns populated will vary with each run. There is data below row 6 that I do not want to grab.


I have attempted to Read Range of “D4” then perform a While Loop to loop through just the first 3 rows but am getting an error “Input array is longer than number of columns in the table”.

1 Like

Hi @bambiCow

Can u show the screenshot of workflow

Hey @bambiCow,

Yes that’s right behaviour.

So to avoid that you need to first add the row which has max number of columns.

!! But doing this your row addition order may change, To avoid this as well

You can first find the max column count among the three rows & add those columns to the DT and then proceed with the data row addition.

Thanks :slight_smile:

Ended up removing all of the rows until just three remained in dt_Dcol datatable (see screenshot).

@Nithinkrishna can you please elaborate on what you are saying and add an image or upload your workflow? I tried add a datarow with the max columns and got the message: This row already belongs to another table.

1 Like

Hey @bambiCow,

I know, That approach is a little tedious and require querying.

But, the easiest way of doing it is to copy schema before trying to add in the new data table.

So, Before performing a while loop to add in new DataTable - Just clone old table to new as below in an assign.

image

This will copy the entire schema from old DataTable to the new DataTable in which you are trying to add.

Doing this will avoid, “Input array is longer than number of columns in the table” Error.

Then you can proceed with same adding logic after clone.

Hope this helps :slight_smile:

Thanks !