Excel : write in the first empty column in the last row

Hello,
I want to write a unique value from a variable string into the next empty cell of my datatable. I already know how to get the last empty column and the last row but I cannot mix them. if someone could help please :


Explanation : I get value from SAP this first value need to be in the first empty cell in my datatable (in column H2 here) then the next value should be in I2 then J and K ect…. and again with the next line (it is in a loop)
I think it is possible with mixing last row and first empty column but how to do that?
Kind regards

Hi @semir

Refer this pseudo code might be helpful, Let me know if you need anything

2 Likes

Hi @Vishal_K
thanks a lot! this work really good …exept only one detail : at the end the workflow break with this error on the write range activity :

Result in Excel is fine :


If I make break activity in for each would be sufficient ? because this sequence is contained in an other Loop for each which get value from SAP and the value change in each column that why I need to write only one cell each time this sequence run.

hi, I’ve tried the same but can’t assign string value the way like you do, get error see screenshot

Hi, i share attached my workflow, this method work for me.Testeur.xaml (11.1 KB)

1 Like

@semir

Is this resolved? or you need help on this? you can see my pseudo code, I have written write range outside the foreach datatable.

I saw your XAML file and find this image below where you need to place write range outside and after foreach and then do run file once again

Basically when you update row(column) your dtTest datatable rows value for particular column will be updated for all the rows one by one. After that you are doing a write range at the end at one shot. let me know if you need further assistance

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