Guest User

Untitled

a guest
Mar 21st, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. function doGet(e){
  2. // code make changes to spreadsheet
  3.  
  4. // here I want browser window to close
  5.  
  6. return HtmlService.createHtmlOutput(uniqueid + " is marked complete");
  7. };
  8.  
  9. <script>
  10. window.top.close();
  11. </script>
  12.  
  13. <script>
  14. setTimeout(function(){ window.top.close(); }, 3000);
  15. </script>
  16.  
  17. <script>
  18. window.onload=function(){
  19. console.log("This onload did run");
  20. setTimeout(function(){ window.top.close(); }, 3000);
  21. };
  22. </script>
  23.  
  24. <!DOCTYPE html>
  25. <html>
  26. <script>
  27. window.top.close();
  28. </script>
  29. </html>
  30.  
  31. function doGet(e){
  32. // code make changes to spreadsheet
  33. var ss = SpreadsheetApp.openById([The key for the spreadsheet you wish you modify])
  34. var sheet = ss.getActiveSheet()
  35. var lastRow = sheet.getLastRow()
  36. var params = JSON.stringify(e);
  37. var paramsArray = JSON.parse(params)
  38. sheet.getRange(lastRow + 1, 1).setValue('Code made changes to spreadsheet at ' + Date())
  39. sheet.getRange(lastRow + 1, 2).setValue(paramsArray.parameter.change)
  40.  
  41. // here I want browser window to close
  42. var uniqueid = "Someuniqueid"
  43. return HtmlService.createHtmlOutputFromFile('Close Window'), HtmlService.createHtmlOutput(uniqueid + " is marked complete")
  44. };
  45.  
  46. function mailIt() {
  47. var emailAddress = Browser.inputBox('What email address do you want to send the WebApp to?')
  48. var html = HtmlService.createTemplateFromFile('HTML Email to run Web App')
  49. var htmlCode = html.getRawContent()
  50. Logger.log(htmlCode)
  51. MailApp.sendEmail({
  52. name: "Publish WebApp for survey embed Test",
  53. to: emailAddress,
  54. subject: "Publish WebApp for survey embed Test",
  55. htmlBody: htmlCode
  56. })
  57. }
  58.  
  59. <!DOCTYPE html>
  60. <html>
  61. <form action=[Your current Web App URL in quotes]>
  62. Send text to spreadsheet: <input type="text" name="change"><br>
  63. <input type="submit" value="Submit">
  64. </form>
  65. </html>
  66.  
  67. google.script.host.close();
Add Comment
Please, Sign In to add comment