Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Google Apps Scriptで三日坊主を克服する
Search
tadaken3
October 30, 2017
Programming
2
1.3k
Google Apps Scriptで三日坊主を克服する
10/31にGaiaxさんが主催の『Google Apps Script 活用ミートアップ』で使用した資料です。
https://gaiax.connpass.com/event/69200/
tadaken3
October 30, 2017
Tweet
Share
More Decks by tadaken3
See All by tadaken3
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
710
Exploratory:プロダクト活用度の話
tadaken3
0
45
[我が社のデータエンジニアリング現場]我が社が考える最強のデータ基盤・開発体制!
tadaken3
0
83
はじめてのWatchOSアプリ。はじめてのiOSアプリ
tadaken3
0
55
拡張現実を活用して幸福度をあげる方法
tadaken3
0
930
LINE Notifyで作る健康習慣をサポートする仕組み
tadaken3
0
1.1k
チームづくりにおける成功法則 - LINEにおけるHR Techの取り組み- / people analytics tokyo
tadaken3
1
4.2k
Google Data Studioで イカしたダッシュボード作る
tadaken3
0
1.4k
Other Decks in Programming
See All in Programming
定理証明プラットフォーム lapisla.net
abap34
1
640
AWS re:Invent 2024個人的まとめ
satoshi256kbyte
0
150
Vue.jsでiOSアプリを作る方法
hal_spidernight
0
120
2025.01.17_Sansan × DMM.swift
riofujimon
2
640
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
350
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
450
Flatt Security XSS Challenge 解答・解説
flatt_security
0
970
DMMオンラインサロンアプリのSwift化
hayatan
0
230
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
190
Java Webフレームワークの現状 / java web framework at burikaigi
kishida
7
1.9k
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
140
[Fin-JAWS 第38回 ~re:Invent 2024 金融re:Cap~]FaultInjectionServiceアップデート@pre:Invent2024
shintaro_fukatsu
0
340
Featured
See All Featured
It's Worth the Effort
3n
184
28k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Embracing the Ebb and Flow
colly
84
4.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
The Language of Interfaces
destraynor
156
24k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
990
Transcript
Google Apps ScriptͰ ࡾओΛࠀ͢Δ @tadaken3
ࣗݾհ • λμέϯ(@tadaken3) • ژग़ • ෳۀɿ͍ͭྡʹITͷ͓ࣄʢhttps://tonari-it.comʣ • झຯɿࣗసंɺےτϨ •
ຊۀɿσʔλΞφϦετ
ےτϨͯ͠·͔͢ʁ
ےτϨ͍ͨ͠Ͱ͢ΑͶʁ
͔ͤͬ͘δϜ௨͍Λ࢝Ί͚ͨͲɺ • ࣄ͕ͯ͘͠ • ࠓɺӍ͔ͩΒ • ҿΈձʹ༠ΘΕͨ • Δؾ͕ग़ͳ͍ ͋Δ͋Δ
Google Apps ScriptͰࡾओΛࠀ͢Δ ؍ଌ͑͞Ͱ͖ΕׯবͰ͖Δɻ ׯবͰ͖ΔͳΒɺ੍ޚͰ͖Δɻ
ᶃߦಈͷه ᶆૹ৴ࢦࣔ ᶅܭࢉ݁Ռͷ อଘ ᶄܦաͷ ܭࢉ εϓϨουγʔτ εϚʔτϑΥϯ Google Apps
ScriptͰࡾओΛࠀ͢Δ Google Apps Script LINE Notify API
Google Apps ScriptͰࡾओΛࠀ͢Δ IFTTTͰϘλϯΛ࡞Δ
Google Apps ScriptͰࡾओΛࠀ͢Δ εϓϨουγʔτʹه
Google Apps ScriptͰࡾओΛࠀ͢Δ //IFTTTͷܗ͔ࣜΒ௨ৗͷʹม function toDateFromIFTTT(str){ str = String(str); str
= str.replace(/at.*/,"")//ਖ਼نදݱͰatΑΓޙΖͷ෦Λআ d = new Date(str); return d; } IFTTTͷܗࣜ(str)Λdateʹม
Google Apps ScriptͰࡾओΛࠀ͢Δ var ss = SpreadsheetApp.getActiveSpreadsheet(); //εϓϨουγʔτΛऔಘ var sheet
= ss.getSheetByName("log"); //γʔτΛऔಘ //γʔτͷ࠷ऴߦʹܦաΛܭࢉ͢ΔࣜΛηοτ͢Δ function setFormuraLastRow(){ //γʔτͷ༻ൣғͷ͏ͪ࠷ऴߦΛऔಘ var maxRow = sheet.getDataRange().getLastRow(); //Aྻͷ࠷ऴߦͷΛऔಘ var str = sheet.getRange(maxRow,1).getValue(); //εϓϨουγʔτ༻ͷࣜ var code = '=TODAY() - TO_DATE(B'+ maxRow+')'; //ϑΥʔϚοτͨ͠Ληοτ sheet.getRange(maxRow,2).setValue(toDateFromIFTTT(str)); //ࣜΛηοτ͢Δ sheet.getRange(maxRow,3).setFormula(code); } ܦաΛܭࢉ͢Δ
Google Apps ScriptͰࡾओΛࠀ͢Δ ܦա͕ܭࢉͰ͖ͨ
Google Apps ScriptͰࡾओΛࠀ͢Δ //LINEʹ௨ΛૹΔؔ function sentToLine(message){ var token = "ઌఔऔಘͨ͠ΞΫηετʔΫϯ";
var options = { "method" : "post", "payload" : "message=" + message, "headers" : {"Authorization" : "Bearer "+ token} }; UrlFetchApp.fetch("https://notify-api.line.me/api/notify",options); } LINE NotifyʹϝοηʔδΛૹΔ
Google Apps ScriptͰࡾओΛࠀ͢Δ function main(){ setFormuraLastRow() var maxRow = sheet.getDataRange().getLastRow();
var passDate = sheet.getRange(maxRow,3).getValue(); var message =""; //ܦա͕̏͘͠7Ҏ্ͩͬͨΒLINEʹ௨ΛૹΔ if (passDate==3 || passDate>=7){ message = "࠷ऴτϨʔχϯά͔Β"+ passDate + "ܦա͠·ͨ͠"; sentToLine(message); } } Θ࣮ͤͯ͢Δ
·ͱΊ • IFTTTΛͬͯγʔτʹߦಈΛه • GASͰܦաΛܭࢉͱૹ৴ఆ • LINE NotifyͰ௨ Google Apps
ScriptͰࡾओΛࠀ͢Δ
ଞʹ • Fitbit APIͱΘͤͯઁऔΧϩϦʔͱӫཆૉΛ௨ • ΰϛͷͷલʹ௨ • ༑ਓͷੜͷ1िؒલʹ௨ ͋ͳ͚ͨͩͷ ύʔιφϧτϨʔφʔ݉Ոఉbot͕࡞ΕΔ
– tadaken3 “ ےτϨʹGoogle Apps Scriptʹ ऴΘΓ͕ͳ͍”
ϒϩάͷಡऀొ͓ئ͍͠·͢ʂ http://tadaken3.hatenablog.jp
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠