Labels

Learn the powerful enterprise adaptable database:

Getting Started With ADABAS & Natural

Friday, January 1, 2016

1001 Apps Script : File Folder Properties

.
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.


.

1000 Introduction To Apps Script

.
1000 Introduction To Apps Script


1. Log into http://drive.google.com
2. Right-click and select Google Apps Script.


1. Give a name, ie first-script.
2. Type "Logger.log("Hello World");"
3. Click Save button.
4. Click Run button.
(You may be required to set Allow Permission to run the script)

1. Select menu View/Logs

1. The string "Hello World" is shown in the Logs window.
.
REFERENCES:
https://www.lynda.com/Google-Apps-tutorials/Welcome/380092/437142-4.html