I have two scripts:
Script A: Takes raw data from an input sheet and outputs formatted data (stored in var resultRows
to the output sheet.
Script B: Stores resultRows
to a MySQL database.
Here's how I would like the process to work:
One way to do this would be to re-generate resultRows
in Script B and then insert to DB, but I know I should be able to pass resultRows
from Script A to Script B as an argument. Something like..
function scriptA() {
//dosomestuff
return resultRows;
}
function scriptB(data) {
//insert data to db
}
scriptB(resultRows);
Script A is executed from the Google Spreadsheets menu (via the .addMenu
method), but I don't know how to pass an argument to a function that's executed in this way (you can only pass a funciton name to .addMenu
) and I'm not sure the resultRows
variable would be available to the function in any case.
Maybe running the function from a UI element makes more sense? Any ideas? Thanks!
Maybe try using the cache service?
I was able to pass a value from one function to another by pushing the value to a key via the cache service and recall it in the other function. Am not sure how long cache service can store it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.