I’m trying to write “completed” using write cell for each row of data, but only the first row gets written on the excel. What am I doing wrong?
Hi @avengeance
Please move this activity Count = Count+1 after write cell activity, it might works.
Thanks
Latika
Hi Latika, it didn’t work. The “status” word in my header was substituted with completed instead. Shall I share my script? Would that be better?
Hi Nived, yes count is increment after every iteration. Shall I share my script for you to take a look?
Hi,
Check the scope of count.
Thanks
@avengeance - please try without excel application scope. I too recently faced the same issue.
Hi @avengeance
Could you try to use an Assign activity before the write cell.
Cell = “F”+Count.ToString
Then pass “Cell” in the Write cell instead of “F”+Count.ToString (this depends on your header so count index should ideal start at 2 = “F”+“2”)
OR
Suggestions:
Index vs Count +1 : When you use a For each row, you don’t need a counter variable. You can go to the properties and use the Index output. This Int32 variable increments automatically (which is similar to count + 1). This starts at zero index so a small manipulation in the Assign activity should be sufficient.
Status: You could create a variable “Status” and can assign appropriate messages “Completed”, “Pending” etc.
The suggested workflow with annotations:
Main.xaml (9.7 KB) Test.xlsx (8.6 KB)
Hope this helps!
Sorry Jeevith, i’m quite new to this. Still didn’t work for me Could u help to see what i’m doing wrong?Date Change.xaml (83.4 KB)
You are very close.
- The index variable you created needs to have a higher scope (in the image i took it for the whole worfklow but you could also change it to Date_Change) - Yellow mark on the bottom.
Why so? Its because although you will use the Index variable within the body scope. The Index has to be initialized outside the scope of Body. In your case that is Date_Change.
- You have to assign the Index variable as output from the For each row. Yellow mark on the right.
- A good practice is to try and remove all unwated variables (Count was still mentioned) by using the top ribbon. That way you know the workflow has only required variables.
Updated file - Date Change.xaml (85.0 KB)
It worked! Thanks so much @jeevith or the detailed explanation!
Perfect. Glad I could help.
Could you kindly close this thread by marking the answer as the solution.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.