GAS googleドライブ内のファイルの編集者を一覧取得する
- 作成日 2022.11.27
- Google Apps Script
- Google Apps Script

GAS(Google Apps Script)で、googleドライブ内のファイルの編集者を一覧取得する手順を記述してます。「getEditors」で取得でき、「for-in」などを使用してループ処理で各要素を取得できます。
環境
- OS windows11 home
- ブラウザ chrome 107.0.5304.107
ファイルの編集者を一覧取得
ファイルの編集者を一覧取得するには、「getEditors」を使用します。
getEditors(file)
実際に、取得してみます。
function myFunction() {
// idからファイルを取得
let file = DriveApp.getFileById('xxxxxxxxxxxxxxxxxxx');
let editors = file.getEditors();
// ループ処理で全て取得
for (let i in editors) {
cosole.log( editors[i].getName() );
}
}
※ファイルのidは、対象を「Ctrl」+「C」でURLのコピーをして「URL」から確認できます。

-
前の記事
centos9 PostgreSQLをアンイストールする 2022.11.27
-
次の記事
mac コマンドでzip化してパスワードを設定する 2022.11.27
コメントを書く