How to get the url parameters when using Logger.log it shows the inputted parameter.

621 views
Skip to first unread message

MenGue

unread,
Jan 2, 2022, 12:11:09 PM1/2/22
to Google Apps Script Community
Hello everyone! Happy new year!

I need some help over here. I've been researching but I have not found a solution to this.

I am getting started with Web App (with Apps Script) and I am following this tutorial here
and the instructor is using the old Apps Script editor and I am not able to get what he gets when using Logger.log with URL parameters. 

He inputs the parameter manually on the URL then updates the page, then goes back to the Apps Script editor runs the code and logger. 

I would appreciate any help.

This is the JS code 

function doGet(e){

Logger.log(e)
console.log("Hello")
  return HtmlService.createHtmlOutputFromFile("page");
}

This is the HTML code

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>

    <h1>Hello Gilbert</h1>
    
  </body>
</html>







first.PNG



second.PNG




Jonathan Butler

unread,
Jan 2, 2022, 2:18:20 PM1/2/22
to Google Apps Script Community
You should be able to console log the parameters and view it in the script executions to achieve the same result.
Message has been deleted

Clark Lind

unread,
Jan 3, 2022, 8:13:57 AM1/3/22
to Google Apps Script Community
1) ensure you have published the webapp.
2) Get the published url and add any parameter at the end of the url and hit return
3) this triggers the doGet(e) function which will log the event (e) along with any parameters. 
4) don't run it manually after entering the url as you will simply overwrite the log file. 
5) open a new browser tab and go to the apps script dashboard/my executions to view the log. You should be able to see both manual and "doGet" executions.
6) just use console.log as logger.log is mainly for the old IDE. 

I'm happy to help. I too used this set of videos to get started with apps script web apps, and I support him on Patreon.

Gilbert Mendoza

unread,
Jan 3, 2022, 8:47:58 AM1/3/22
to google-apps-sc...@googlegroups.com
Thank you so much for your help guys I got it now I was missing one me step! 

--
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/qc2mpT3nIUE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/47ec651a-7e7b-4cf8-973a-4999e379dc2fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages