Google 文档允许编写脚本。
当单元格内容与特定单词匹配时,我试图更改单元格的颜色。我的问题是 onEdit 函数无法按照此处指定的方式工作:https ://developers.google.com/apps-script/guide_events#Simple
每当我尝试使用 event.source 谷歌应用程序时都会抛出错误:“来源未定义”
function onEdit(event)
{
Browser.msgBox(event.source.getActiveSheet());
}
Run Code Online (Sandbox Code Playgroud)
当然这是非常基本的,我在这里做错了什么吗?
我一直在尝试对 Google 的 Admin API 进行查询,以列出我的 Google Apps 组织中的所有用户。我有权在Web UI 示例中进行此查询并获取结果,但当我尝试使用服务帐户进行查询时,会出现 403 错误。
import (
"fmt"
"io/ioutil"
"log"
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
directory "google.golang.org/api/admin/directory_v1"
)
func main() {
serviceAccountJSON, err := ioutil.ReadFile(serviceAccountFile)
if err != nil {
log.Fatalf("Could not read service account credentials file, %s => {%s}", serviceAccountFile, err)
}
config, err := google.JWTConfigFromJSON(serviceAccountJSON,
directory.AdminDirectoryUserScope,
directory.AdminDirectoryUserReadonlyScope,
)
client, err := directory.New(config.Client(context.Background()))
if err != nil {
log.Fatalf("Could not create directory service client => {%s}", err)
}
users, err := client.Users.List().ViewType(publicDataView).Domain(domain).Do() …Run Code Online (Sandbox Code Playgroud) go google-apps google-oauth service-accounts google-admin-sdk
我在 AWS Route53 上设置了一个域,并使用 GoogleApps 来管理电子邮件帐户。我在向其他域发送邀请(Google 日历/环聊)时遇到问题。这些邀请将进入垃圾邮件箱。
我的 DNS 配置
$ dig -t any matheuscarino.com.br
;; ANSWER SECTION:
matheuscarino.com.br. 27 IN A 54.88.183.99
matheuscarino.com.br. 27 IN A 54.86.206.71
matheuscarino.com.br. 21567 IN NS ns-1324.awsdns-37.org.
matheuscarino.com.br. 21567 IN NS ns-1966.awsdns-53.co.uk.
matheuscarino.com.br. 21567 IN NS ns-691.awsdns-22.net.
matheuscarino.com.br. 21567 IN NS ns-7.awsdns-00.com.
matheuscarino.com.br. 867 IN SOA ns-1966.awsdns-53.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400
matheuscarino.com.br. 267 IN MX 1 aspmx.l.google.com.
matheuscarino.com.br. 267 IN MX 10 alt3.aspmx.l.google.com.
matheuscarino.com.br. 267 IN MX 10 alt4.aspmx.l.google.com.
matheuscarino.com.br. 267 IN …Run Code Online (Sandbox Code Playgroud) 我发布了一个 Google Apps 脚本独立电子表格插件,但在使用PropertiesService.getUserProperties()自定义函数时遇到了一些问题。
如果用户 A 安装了该附加组件并在用户属性中保存了一些数据。然后用户A将电子表格共享给用户B。当用户B运行自定义函数时,他可以获取用户A的用户属性中保存的数据。这不是我认为用户属性的工作原理。用户 A 和 B 都应该获得自己保存的数据。
那么共享电子表格的活跃用户是什么?我不希望所有电子表格查看者都获取电子表格创建者保存的数据。我在代码或“云平台项目”选项中做错了什么吗?
换句话说,如何在共享电子表格中为不同查看者获取保存在用户属性中的不同数据?
我尝试在自定义函数中获取活动用户电子邮件,但它不起作用。
请注意,我无法Session.getActiveUser在自定义函数中使用,因为Google Apps脚本自定义函数不支持会话服务。它将得到无效权限异常。
https://developers.google.com/apps-script/guides/sheets/functions#Advanced
谢谢,
google-apps google-apps-script google-apps-marketplace custom-function google-apps-script-addon
我需要每天运行 Google Apps 脚本三次:8:00、12:30、17:00。
这该怎么做?
我已经看过了Triggers,更具体地说Time driven:
小时计时器,但是Every hour,Every 2 hours,Every 4 hours未在此处进行调整
日定时器,但8am to 9am不是很精确,我更喜欢更精确的东西,而且 12:30 也是不可能的
特定时间,但随后YYYY-MM-DD HH:MM不适合每天运行
From calendar 触发器似乎也没有适应。
javascript triggers google-apps google-apps-script gs-installable-triggers
有没有办法直接从 Google Sheet 下载 JSON,如下所示:

我想使用应用程序脚本创建自定义菜单。会有一个按钮可以从工作表数据创建 JSON 对象,完成后会立即将其下载为文件。因此,不涉及 GDrive 或其他应用程序,只有 Google 表格和应用程序脚本。
这有可能做到吗?我找不到这样的东西。
json google-apps google-sheets google-apps-script google-sheets-api
在过去的几天里,我发布了一些关于我正在开发的Google Apps脚本Web应用程序的问题.到目前为止,Serge在这里一直非常有帮助.该剧本的帖子就在这里.
我希望在该脚本中添加一列来生成uniqueID计数器,这样当提交新表单时,计数器将看到先前的唯一ID并增加1.想法将是带有标题行的空白电子表格.脚本在表单提交上运行,参见A2为空白并插入1.下一个提交的表格将在A2中看到2添加1并在A3中添加3,依此类推.
现在我正在研究计数器加1对单元格中的数字.我知道,当我开发这篇文章时,我需要抓住最后一行,然后找到单元格值并添加,但是因为我是GAS的新手,我正在自学,所以我想要慢慢地建立嗯,你明白了.
这是一个基本的开始,我想得到一些反馈,如果这是一个正确的方向开始..
function counter() {
//Grabs the range and pinpoint cell
var ssRange = SpreadsheetApp.getActiveSheet().getRange(1,1,1,1);
//Grab the cell value of A1
var value = ssRange.getValue();
//if statement to check value in A1 and if it is null, undefined, false, 0, NAN
if (!value) {
//if the cell is null, undefined, false, 0, NAN sets value to 1
var setCell = ssRange.setValue(1);
}
//if not updates the cell by getting the value and adding 1 to …Run Code Online (Sandbox Code Playgroud) 我们创建了一个用于邮件合并目的的Google应用脚本.我们打开一个Google文档,然后打开一个脚本,用于选择包含地址的电子表格,选择电子表格后我们需要授权代码.我们可以在脚本编辑器中进行授权,但是会为每个邮件合并类型复制此文档,因此最终用户需要进行授权.那么这就是问题发生的地方.最终用户只会收到消息.
"遇到错误:执行该操作需要授权."
好的,但通常由网络应用程序显示的弹出窗口不会出现.所以用户根本无法授权.我们不能要求我们的最终用户转到脚本编辑器并运行代码编辑器,以便他们能够进行授权.
我们可以在脚本中手动弹出授权代码吗?
我试图在应用程序脚本文档后发布一个Spreadsheet Add-on,但是我收到此错误:
请修正以下错误:
- 具有在清单的api_console_project_id字段中指定的ID的API控制台项目未启用Google Apps Marketplace SDK.api_console_project_id
在这里您可以看到截图:http://i.stack.imgur.com/s3w3h.png
在文档里面说:
千万不能上传页面顶部的上传部分文件; Apps脚本会自动为您生成此文件,上传单独的文件将导致发布失败.
据我所知,api_console_project_id在manifest.json中,但它表示我不应该上传任何内容,对吧?(developers.google.com/apps-marketplace/listing#the_manifest_file)
有谁知道我该做什么或为什么我不能发表?
谢谢!
我已经阅读了教程并且已经看了两天的例子,但没有成功.我想在NodeJS环境中使用Google Apps Gmail帐户发送电子邮件,但是,我得到400了Google API的回复:
{[Error: Bad Request]
code: 400,
errors:
[{
domain: 'global',
reason: 'failedPrecondition',
message: 'Bad Request'
}]
}
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止所做的:
Domain Wide Delegation服务帐户JSON格式下载服务帐户的密钥API Manager> Credentials我创造了OAuth 2.0 client ID 在Google Apps管理控制台中:
Security> Advanced Settings> Manage API client access我已经添加了Client ID从步骤4上述Client ID这是尝试发送电子邮件的代码:
const google = require('googleapis');
const googleKey = require('./google-services.json');
const jwtClient = new …Run Code Online (Sandbox Code Playgroud) google-apps ×10
javascript ×3
dmarc ×1
email ×1
gmail ×1
go ×1
google-oauth ×1
json ×1
jwt ×1
node.js ×1
spf ×1
triggers ×1