In a template, how can I have a counter?

I require basic incrementation arithmetic and loop for my project to keep the template readable and populate a 9x9 grid with values. The values are stored in a string array and so it is necessary t...