This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ドライブのファイルIDを取得 | |
| // 該当のファイルIDを確認して別で取得することができる | |
| var file = DriveApp.getFileById('xxxxxxxxxxxxxxxxxxxx'); | |
| // ファイルの編集者らを取得 | |
| var editors = file.getEditors(); | |
| // 共同編集者をログに出力する | |
| for (var i = 0; i < editors.length; i++) { | |
| Logger.log(editors[i].getDomain()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 編集可能なファイルの編集者のメールアドレスを取得する | |
| var file = DriveApp.getFileById('XXXXXX'); | |
| // ファイルの共同編集者の情報を取得する | |
| var editors = file.getEditors(); | |
| // 共同編集者のメールアドレスを取得する | |
| for (var i = 0; i < editors.length; i++) { | |
| Logger.log(editors[i].getEmail()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 編集可能なファイルの編集者の名前を取得する | |
| var file = DriveApp.getFileById('xxxxxx'); | |
| // ファイルの共同編集者の情報を取得する | |
| var editors = file.getEditors(); | |
| // 共同編集者のユーザ名を取得する | |
| for (var i = 0; i < editors.length; i++) { | |
| Logger.log(editors[i].getName()); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ファイルIDを引数にファイル情報にアクセス | |
| var file = DriveApp.getFileById('XXXXXX'); | |
| // ファイルの共同編集者を取得する | |
| var editors = file.getEditors(); | |
| // 共同編集者のプロフィール画像のURLをログに出力する | |
| for (var i = 0; i < editors.length; i++) { | |
| Logger.log(editors[i].getPhotoUrl()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ログにドライブ内の含まれているファイルすべての名前を出力する | |
| var files = DriveApp.getFiles(); | |
| // ファイル数の分だけ繰り返し処理を実施する | |
| while (files.hasNext()) { | |
| var file = files.next(); | |
| Logger.log(file.getName()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Creates a folder that anyone on the Internet can read from and write to. (Domain | |
| // administrators can prohibit this setting for users of a G Suite domain.) | |
| // フォルダ名を指定して新しいフォルダを生成する | |
| var folder = DriveApp.createFolder('Shared Folder'); | |
| // 第一引数には、ドライブの公開範囲、第二引数には、第一引数の範囲にどんな権限を与えるのか | |
| folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 指定したスプレッドシートが一週間更新されていない場合は削除する | |
| var files = DriveApp.getFilesByName('Untitled spreadsheet'); | |
| while (files.hasNext()) { | |
| var file = files.next(); | |
| // 実行日 - ファイルの最終更新日 > 日数 * 時間 * 1時間(60) * 1分(60) * 1秒(1ミリ秒) | |
| if (new Date() - file.getLastUpdated() > 7 * 24 * 60 * 60 * 1000) { | |
| file.setTrashed(true); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The code below creates a new spreadsheet "Finances" and logs the URL for it | |
| var ssNew = SpreadsheetApp.create("Finances"); | |
| Logger.log(ssNew.getUrl()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $juices = array("apple", "orange", "koolaid1" => "purple"); | |
| echo "He drank some $juices[0] juice.".PHP_EOL; | |
| echo "He drank some $juices[1] juice.".PHP_EOL; | |
| echo "He drank some $juices[koolaid1] juice.".PHP_EOL; | |
| class people { | |
| public $john = "John Smith"; | |
| public $jane = "Jane Smith"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // デフォルト値はnull | |
| function get_header( $name = null ) { | |
| /** | |
| * ヘッダーテンプレートファイルを読み込む前に発火させる(意訳) | |
| * Fires before the header template file is loaded. | |
| * | |
| * @since 2.1.0 | |
| * @since 2.8.0 $name parameter added. | |
| * |
OlderNewer