Google Apps Script ドライブ内のファイルのURLを取得するサンプル

環境
Google Chrome  122.0.6261.129(Official Build) (64 ビット)
Windows 11 Pro 64bit

構文
file.getUrl()
ファイルのURLを取得するには、「getUrl」を使用します。

使用例
googleドライブ内のファイルのURLを取得します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function myFunction() {
// idから取得
let f = DriveApp.getFileById('1xxx6');
console.log( f.getUrl() );
}
function myFunction() { // idから取得 let f = DriveApp.getFileById('1xxx6'); console.log( f.getUrl() ); }
function myFunction() {

  // idから取得
  let f = DriveApp.getFileById('1xxx6');

  console.log( f.getUrl() );

}

 

Google Apps Script

Posted by arkgame