Data posted to two rows of a googlesheet appear in different order

I have prepared a Googlesheet and added the Post and Get script recommended by Metricat. I have deployed the sheet and stored its URL in a global variable in my App block code.
My app generates data consisting of a row of headings and a row of data values for each heading, which I turn into two seperate Lists using the "Make a list" component
Using a Web component, Web1, I can post each list to the Googleshet using a standard block, such as

image

I post the heading list, then the data list. Unfortunately, the lists do not always appear in the Googlesheet in the order posted.
Is there a way of joining the two lists so that they can be posted together such that the lists appear on successive rows of the Googlesheet in the correct order?
Thanks in advance.

Show an example of your two lists

here is some code:

Are the two lists the same length, that is contain the same number of items ?

Please also provide a link for the guide you are following on Metricrat-Ai2

Yes, absolutely. The lists get posted fine, sometimes just not in the order posted.
Here is a sample test run. Every Heading has a matching value (or vice versa).

I just added this script from his help article to the sheet, then deployed the sheet.

I do not use the Get function.

Can I also say that, at the same time, I produce a file (filename.CSV) by appending the sets of comma-seperated text/number values for both headings and data, with a \n newline character seperating the two sets. When I open the saved file in Excel or other spreadshseet type, the data appears as expected in two seperate rows. So should I try posting the .CSV file to the Googlesheet instead? I have only just thought of that.

The easiest thing to do is to first post the headings, then after this is successful post the data row.

You can do the send post in the web1.gotText event block, after receiving confirmation in the responseContent that the first post completed successfully.

Thankyou. I wil try that. :+1: