1001 Apps Script : File Folder Properties
function myFunction() {
try{
//scriptid
var scriptid=ScriptApp.getScriptId();
Logger.log("scriptid:"+scriptid);
} catch(e) {
Logger.log("script error:"+e.message);
}
try{
//sheetid
var sheetid=SpreadsheetApp.getActiveSpreadsheet().getId();
Logger.log("sheetid:"+sheetid);
} catch(e) {
Logger.log("sheet error:"+e.message);
}
try{
//docid
var docid=DocumentApp.getActiveDocument().getId();
Logger.log("docid:"+docid);
} catch(e) {
Logger.log("doc error:"+e.message);
}
try{
//formid
var formid=FormApp.getActiveForm().getId();
Logger.log("formid:"+formid);
} catch(e) {
Logger.log("form error:"+e.message);
}
try{
//siteid
var siteid= SitesApp.getActiveSite().getId();
Logger.log("siteid:"+siteid);
} catch(e) {
Logger.log("site error:"+e.message);
}
}
|
If you run a standalone script, you will get the log as shown above.