-
Notifications
You must be signed in to change notification settings - Fork 0
BONUS. Pizza Dashboard
Generate so much pizza data that you just have to put it in a dashboard? Really want to see how much all that happiness pizza is costing you? No?
Well I'm going to show you anyways. You can automatically stream to an Initial State dashboard every time you order pizza.
As you've probably guessed, IFTTT is going to have a part in this. This time we're using the Gmail trigger's "If new email in inbox labeled" and the Google Drive's action "Add row to spreadsheet".
Connect your accounts and enter the gmail label you used for your Pizza Hut confirmation emails. I get emails from Twitter when I receive tweets, so I created a label from the filter "total is" "pizza hut".
Next name the spreadsheet you want rows added to - I named mine "Pizza Time". I entered {{ReceivedAt}} ||| {{BodyPlain}} as my formatted row. Save and finish the recipe. You can test it by forwarding yourself an old confirmation email.
Now head over to Google Sheets and find that spreadsheet we created (Pizza Time). You should see the time the email was sent and the body of the email in adjacent cells.
Create a new sheet and enter the following formulas
- In A1: =IFERROR(Sheet1!A1)
- In B1: =IFERROR(REGEXEXTRACT(Sheet1!B1,"[\$\£\€](\d+(?:\.\d{1,2})?)"))
- In C1: =IFERROR(REGEXEXTRACT(REGEXEXTRACT(Sheet1!B1, "ETA:.*minutes"),"([0-9]+)"))
You should see the following output in cells A1:C1:
In order to get this data into a dashboard, we are going to stream it to Initial State using Google Apps Script. I am not going to go over much about these, but you can read more in this blog post. The basics are:
- Create an Initial State account
- Go to Tools -> Script editor... inside of your Pizza Time Google sheet
- Copy-paste this script into the editor
- Create a bucket inside of Initial State (I named mine 🍕👟 Pie Tops and gave it the bucket key "pietops")
- Put your Initial State access key into line 32 and your bucket key on line 33 if you didn't specify it in #4
- Set a time-driven trigger for how often you want your Apps Script to check for updates in the spreadsheet
Head on over to Initial State and check out your dashboard! After a little magicking around, it might just be as 🍕-fied as mine. 😜
Initial State (https://www.initialstate.com)
(c) 2018 Initial State Technologies, Inc.