LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Saturday, April 7, 2018

スクリプト内でスクリプトIDを取得する



スクリプトのIDを取得する


コード1.gs
function get_script_id(){
  var script_id = ScriptApp.getScriptId();
  Logger.log(script_id); 
}
意訳
この機能がやること
開いているスクリプトファイルのIDを取得して
ログに出す



スクリプトのURLをログに出す


コード2.gs
function get_script_url(){
  var script_id = ScriptApp.getScriptId();
  var script_url = "https://script.google.com/d/" + script_id + "/edit";
  Logger.log(script_url);
}
意訳
この機能がやること
開いているスクリプトファイルのIDを取得して
URLの文字列を作って
ログに出す



Latest post

Creating a template copier app in Google Apps Script

Introduction This article will show you a template copier application in Google Apps Script.  This application will automatically copy a t...