Adrian:

Thanks for clarifying how you are using GridView.

What you are currently doing, running GridView to output the data to Google Sheets and then using a script to manipulate the data into what you need, is how I would do this (as an off the top of my head answer).

If I come up with a better answer, I'll let you know.
_________________________
Douglas Dickie
AccSys Solutions Inc
Phone: 1.888.534.4344
ddickie@accsyssolutions.com