Upgrade to Pro — share decks privately, control downloads, hide ads and more …

QuickStartToGAS

 QuickStartToGAS

overview of google apps script, tips of development, and sample codes

E7c0cdb6e91562ab5995348cd2b2110e?s=128

gakuji tamaki

March 31, 2019
Tweet

More Decks by gakuji tamaki

Other Decks in Programming

Transcript

  1. Quick Start To GAS Gakuji Tamaki Systems Developer APCommunications Co.,

    Ltd. Twitter: @gkzvoice, Github/Medium: @gkzz
  2. Source; sinap.jp

  3. Table of Contents 1.About Me 2.Today’s Goal 3.Overview of Google

    Apps Script 4.Get Data From SpreadSheet 5.Post Data To Chat App 6.Appendix
  4. 1.About Me Source; Python Logo: www.python.org, CentOS’s: www.centos.org, StackStorm’s: stackstorm.com,

  5. 2.Today’s Goal See A Demo Source; Demo: @gkzvoice Code: github.com/gkzz/gas-handson

  6. Source; giphy.com What’s Going On!?

  7. Source; www.azquotes.com

  8. Does A Function Really Do just One Thing? Function 1

    postData()
  9. Function 3 postOnly() Function 2 getData() Function 1 setUp() Function

    1 postData()
  10. My Opinion: If you feel naming is difficult, split your

    functions/variables into the smaller ones.
  11. Table of Contents (Re:) 1.About Me 2.Today’s Goal 3.Overview of

    Google Apps Script 4.Get Data From SpreadSheet 5.Post Data To Chat App 6.Appendix
  12. 3.Overview of Google Apps Script - Cloud-based Application Development Platform

    - Based on JavaScript - Integrate Easily with Google/Third-Party Apps - Also Allows Scripts to Return HTML Source; Image: www.lucidchart.com Cf. My Sample Script’s URL
  13. Today’s BOT Workflow: - setUp - getData - Boolean (Any

    News?) True False - send “NoNews” - postNews Source; SpreadSheet: www.iconarchive.com, Slack: www.iosicongallery.com, Gmail: www.flaticon.com
  14. Table of Contents (Re:) 1.About Me 2.Today’s Goal 3.Overview of

    Google Apps Script 4.Get Data From SpreadSheet 5.Post Data To Chat App 6.Appendix Function 3 postOnly() Function 2 getData() Function 1 setUp()
  15. 4.Get Data From SpreadSheet See A Demo Source; Demo: @gkzvoice

    Code: github.com/gkzz/gas-handson
  16. Table of Contents (Re:) 1.About Me 2.Today’s Goal 3.Overview of

    Google Apps Script 4.Get Data From SpreadSheet 5.Post Data To Chat App 6.Appendix Function 3 postOnly() Function 2 getData() Function 1 setUp()
  17. 5.Post Data To Chat App See A Demo Source; Demo:

    @gkzvoice Code: github.com/gkzz/gas-handson
  18. Source; sinap.jp 6.Appendix 1.Run Apps Script 2.Use Debugger 3.Add Libraries

    4.Get Incoming Webhook URL 5.Add BOT User 6.Change Permissions 7.Get userID through Tester 8. Deploy as Web App Using Slash Commands 9. All Sample Codes -mailDraft, getUserList, getChannelHistory, etc
  19. 6-1.Appendix Run Apps Script

  20. None
  21. 3.Push “View” and “Logs” Button, See the Logged Output 1.Predict

    Value of Variable 2.Set Logger.log(“val: %s”, val), Run Script Develop & Debug 6-2.Appendix Use Debugger
  22. [19-03-30 21:36:23:487 JST] writeConts: 0.0 [19-03-30 21:36:23:488 JST] Successful! [19-03-30

    21:36:23:489 JST] i: 0.0 [19-03-30 21:36:23:489 JST] value: [Thu Mar 28 13:02:45 GMT+09:00 2019, gendo@example.com, Gendo, NERV, Shinji, Eva1, Mankind’s greatest fear is Mankind itself., , , , , , , , , , Done] [19-03-30 21:36:23:490 JST] writeConts: 1.0 [19-03-30 21:36:23:490 JST] Successful! [19-03-30 21:36:23:491 JST] i: 1.0 [19-03-30 21:36:23:492 JST] value: [Fri Mar 29 13:02:45 GMT+09:00 2019, gendo@example.com, Gendo, NERV, Shinji, Eva1, Mankind’s greatest fear is Mankind itself., , , , , , , , , , Done] [19-03-30 21:36:23:492 JST] writeConts: 2.0 [19-03-30 21:24:55:236 JST] valueRange.length: 8.0 [19-03-30 21:24:55:238 JST] Successful! [19-03-30 21:24:55:239 JST] i: 0.0 [19-03-30 21:24:55:240 JST] value: [Thu Mar 28 13:02:45 GMT+09:00 2019, gendo@example.com, Gendo, NERV, Shinji, Eva1, Mankind’s greatest fear is Mankind itself., , , , , , , , , , Done] Source; 1st Code: devel-old/sendRichMsg.js, 2nd: topic-getValueRange/sendRichMsg.js
  23. 6-3.Appendix Add Libraries See A Demo Source; Demo: @gkzvoice Code:

    https://github.com/gkzz/gas-handson Moment.js library key; MHMchiX6c1bwSqGM1PZiW_PxhMjh3Sh48
  24. 6-4.Appendix Get Incoming Webhook URL https://api.slack.com/apps

  25. None
  26. None
  27. 6-5.Appendix Add BOT User

  28. None
  29. 6-6.Appendix Change Permissions

  30. 6-7.Appendix Get userID through Tester https://api.slack.com/methods/users.list/test <Your WorkSpace Name> xoxb-aaaaaaaaaa

  31. 6-8.Appendix Deploy as Web App, Using Slash Commands

  32. https://script.google.com/macros/s/xxxx

  33. Source; Code: https://github.com/gkzz/gas-handson

  34. See A Demo Source; Demo: @gkzvoice Code: https://github.com/gkzz/gas-handson

  35. See A Demo Source; Demo: @gkzvoice Code: https://github.com/gkzz/gas-handson

  36. 6-9. All Sample Codes Go to the Following Github Page

    https://github.com/gkzz/gas-handson
  37. Fin. Twitter: @gkzvoice, Github/Medium: @gkzz