The cumulative total for first data row is SUM(D$2:D2)

Observe that D$2 is a placeholder and when you apply the formula for each cell, it will add the amounts in all previous rows to the current row.

Here is your example in action.

As for putting it into RPA, Excel packages contain activities to apply formula from one cell to all the cells in that column. I think it is Autofill Range Excel Activity.

Well you have to have logic to determine what the cell is in that case. The Robot isn’t expected to know that unless you do.

If the cumulative total column is the last one, it makes this task that much easier. In this case you will need to read the top row of that table into a DataTable, and the number of columns will help you determine which cell is the Cumulative total column.

Example: If the total number of columns in your DataTable is 4, then the last column is D.

You can use this information to apply the cumulative formula to that cell.

I made a few changes to the script and that worked correctly thankyou
I gave the range starting from 0 instead of 1
and then I initialized the value of the first cell of cumulative % same as the percentage cell
and then for the rest of the values where I was not equal to zero, I did the addition for the same row percentage and above cell cumulative percentage