You probably don’t need to do that. Look into the free plugin called ‘orchestra’ it will allow you to run an action in every cell of the rg, which can be to set the value to the cell index.