我正在尝试创建对当前 DriveApp 文件对象(即脚本本身的实际 Google Drive 容器)的引用。这是我想要做的:
// Assume that thisFile is a FileIterator pointing to THIS file.
// My question in a nutshell: How do I get thisFile?
DriveApp.getFileById( thisFile.getId() );
Run Code Online (Sandbox Code Playgroud)
我想这样做而不是 DriveApp.getFileById(id) 因为我不想“硬编码”脚本文件的 ID 字符串。这样,如果我制作 Google Apps Script 项目的副本,则不必在 Code.gs 或 Script Properties 中编辑任何内容。有什么建议?