google-apps-script - 如何使用 google sheet api v4 获取 protectedRangeId?
问题描述
我的目标是使用updateProtectedRange端点来更新现有的受保护工作表。
我的问题是,我首先如何获得 protectedRangeId ?
到目前为止我有这个代码吗?
const p = <target-sheet>.getProtections(SpreadsheetApp.ProtectionType.SHEET)[0];
解决方案
在仔细阅读文档后,我发现使用Sheets.Spreadsheets.get
方法的属性:
const sheets = Sheets.Spreadsheets.get(ss.getId()).sheets;
// here just the first sheet, and first range
const protectedRangeId = sheets[0].protectedRanges[0];
推荐阅读
- php - 为什么在composer-php中安装时我的依赖项冲突?
- python - 检查是否有任何消息内容与数组项匹配
- spring - 如果 bean 类没有任何 getter/setter 方法,则使用和注入 Spring bean?
- android - 为 arm64 Android 手机构建应用程序包时在 ApplicationInfo.nativeLibraryDir 中找不到本机库
- php - 更改 PHP 编译
- laravel - Laravel 5.8 - 一个路由两个不同的控制器动作
- javascript - material-ui useScrollTrigger 与子目标 ref 的用途是什么?
- python - 如何确保在删除某些元素时检查列表中的每个元素
- typescript - 使用 querySelectorAll 时,Typescript 对象可能为 'null'.ts(2531)
- javascript - 寻找一个简单的文本模板引擎来生成查询