Google Apps脚本:可以将http请求发送到不在互联网上的本地服务器? [英] Google Apps Script: Possible to send http requests to a local server that's not on interrnet?

查看:107
本文介绍了Google Apps脚本:可以将http请求发送到不在互联网上的本地服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑一个小项目 Apps脚本,该项目涉及从不在互联网上的本地服务器获取数据,然后用数据填充Google表格数据表...我似乎无法在任何地方找到明确的答案。

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.

是否可以使用<$ c $从Google电子表格发出HTTP请求c>将脚本应用到本地服务器?我假设Javascript是客户端代码,它应该是可能的?

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?

推荐答案

只要本地服务器是从公共地址路由。 Apps脚本专门在Google的基础架构上运行,所以即使您在IDE中单击运行,它也不是运行代码的浏览器,而是一个谷歌服务器。有一种方法可以解决这个问题,因为应用程序脚本可以提供可以与称为webapps的脚本通信的网页。服务的网页在您的浏览器中运行,并可以访问本地主机。

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/

这篇关于Google Apps脚本:可以将http请求发送到不在互联网上的本地服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆