Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
863 views
in Technique[技术] by (71.8m points)

javascript - Google Apps Script: Possible to send http requests to a local server that's not on interrnet?

I'm considering Apps script for a small project that involves fetching data from a local server that's not on the internet and then populating a Google sheets spread sheet with the data... I can't seem to find a clear answer to this question anywhere.

Is it possible to make HTTP requests from a Google spread sheet using Apps Script to a local server? I'm assuming as the Javascript is Client side code it should be possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is possible as long as the local server is route able from a public address. Apps Script runs exclusively on Google's infrastructure so even when you click run in the IDE it is not your browser running the code, but a google server. There is a way to work around this as app script can serve webpages that can communicate with your script called webapps. The served webpages do run in your browser and can access the localhost.

https://developers.google.com/apps-script/guides/web
https://developers.google.com/apps-script/guides/html/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...