我可以从Chrome扩展程序执行Google Apps脚本代码吗? [英] Can I execute Google Apps Script code from a Chrome extension?

查看:133
本文介绍了我可以从Chrome扩展程序执行Google Apps脚本代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个允许用户直接从多功能框发送电子邮件的Chrome扩展程序。是否可以直接执行Google Apps脚本代码,例如 Gmail服务API < a>来自Chrome扩展程序中?

是的,您可以但有一些限制
如果您将应用脚本代码发布为webapp,


$ b eg



<$

$ pre> doGet(e){
//在这里使用e.parameter
//写下您的应用程序脚本代码
返回ContentService.createTextOutput('您的返回内容);
}

发布后,假设您的网址类似于

  https://script.google.com/macros/s/djihwerd98ejdeijded/exec 

现在从您的Chrome应用程序发出请求

  GET https:/ /script.google.com/macros/s/djihwerd98ejdeijded/exec?param=value 


I want to write a Chrome extension that allows users to send emails directly from the omnibox. Is it possible to directly execute Google Apps Script code, such as the Gmail Services API from within a Chrome extension?

解决方案

Yes, you can but with some limitation If you publish your apps script code as a webapp which will be accessible publicly, you can make a GET request to the webapp URL to execute the Apps Script code.

e.g

doGet(e){
//use e.parameter here
//write your apps script code
return ContentService.createTextOutput('your return content');
}

after publishing it, say you got a URL like

https://script.google.com/macros/s/djihwerd98ejdeijded/exec

Now make a request from your chrome app

GET https://script.google.com/macros/s/djihwerd98ejdeijded/exec?param=value

这篇关于我可以从Chrome扩展程序执行Google Apps脚本代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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