I'll explain what I need.
I have a folder in google drive with many google spreadsheets files inside.
Every file is shared with a specific user and is named with a code associated at that user.
Example: file 123456 is shared with user 123456.
Furthermore, on my website there is a Mysql table called "all_orders" that collect every order related to al the users.
user |orderNumber |sku
123456 |1 |as1254
789456 |2 |pt4587
321654 |3 |pt5698
321654 |3 |pt8574
xxxxxx |n |yyyyyy
I want that a script job is scheduled (every hours) and do this:
Execute a query for every xxxxxx user like:
SELECT * FROM all_orders WHERE user="xxxxxx"
Insert the result of the query in the google sheet xxxxxx under the sheet "orders", deleting the data previously written.
I don't know which is the best way to do this, I hope in your help.
This is a sample only , the column are more and the query little more complex with more condition. So I need to access the code easily to personalize the code. Anyway this is the juice.
The code must not be accessible from user with in the files is shared in.