简体   繁体   中英

Running python script from Google Apps script

I have a python script (on my local machine) that queries Postgres database and updates a Google sheet via sheets API. I want the python script to run on opening the sheet. I am aware of Google Apps Script, but not quite sure how can I use it, to achieve what I want.

Thanks

Google Apps脚本在服务器端运行,因此不能用于运行本地脚本。

you will need several changes. first you need to move the script to the cloud (see google compute engine) and be able to access your databases from there.

then, from apps script look at the onOpen trigger. from there you can urlFetchApp to your python server to start the work.

you could also add a custom "refresh" menu to the sheet to call your server which is nicer than having to reload the sheet.

note that onOpen runs server side on google thus its impossible for it to access your local machine files.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM