Apps Scriptリファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary

2021年2月18日木曜日

Googleドライブ内の特定フォルダ内のフォルダ名とidを取得したい


Googleドライブ内で
指定した親フォルダ内の
子フォルダの名前とIDを取得するコードの例です。



コード.gs
function getFoldersInFolder() {
  const folderId = "親フォルダのID";
  const parentFolder = DriveApp.getFolderById(folderId);
  const folders = parentFolder.getFolders();
  let array = [];
  while(folders.hasNext()) {
    const folder = folders.next();
    var obj = {};
    obj["name"] = folder.getName();
    obj["id"] = folder.id();
    array.push(obj);
  }
  Logger.log(array);
}



Latest post

スプレッドシートの空白セルを直前の値で埋めたい

A列の空白セルに直前の値を入れたくて書いたコードです スプレッドシートに以下のようなBeforeの表があるとき (A列に空白セルがある) Before 1 A B 2 エリア 都市 3 東京 新宿 4 渋谷 5 池袋 6 神奈川 横浜 7 川崎 8 相模原 9 千葉 千葉 10 ...