Forked from levelsio/showFirstCellInGoogleSheetAsiOSWidget.js
Created
November 23, 2020 01:52
-
-
Save beelarr/a6b2283f994fc1cc2e7f37985bbd7e5d to your computer and use it in GitHub Desktop.
Revisions
-
levelsio renamed this gist
Nov 22, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
levelsio revised this gist
Nov 22, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ let w = new ListWidget() // Add the value of the stock to the widget t = w.addText(stockValue) t.textColor = Color.black() t.font = new Font("Avenir-Heavy",24) Script.setWidget(w) Script.complete() -
levelsio revised this gist
Nov 22, 2020 . No changes.There are no files selected for viewing
-
levelsio revised this gist
Nov 22, 2020 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,13 @@ // Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e // by @levelsio // HOW TO // 1) Make a Google Sheet, we'll pull the first cell e.g. A1 // 2) Publish your Google Sheet, File -> Publish To Web // 3) Copy the SHEET_ID in the URL, put it in here below: const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json" // 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188 // 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc) // Function that performs the request to the JSON endpoint async function loadItems() { -
levelsio revised this gist
Nov 22, 2020 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,12 @@ // Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e // Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188 // Add the URL of your JSON endpoint (this should be a published Google Sheet, click File -> Publish to Web) const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json" // Or if you have a page on your server with the value to display I'd modify the code below to not get JSON but just the raw value // Function that performs the request to the JSON endpoint async function loadItems() { let at = endpoint -
levelsio revised this gist
Nov 22, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e // The URL of your JSON endpoint (this should be a published Google Sheet, click File -> Publish to Web) const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json" // Function that performs the request to the JSON endpoint -
levelsio created this gist
Nov 22, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ // Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e // The URL of your JSON endpoint const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json" // Function that performs the request to the JSON endpoint async function loadItems() { let at = endpoint let req = new Request(at) let corpo = await req.loadJSON() // We return just the cells return corpo.feed.entry } // Request the spreadsheet data let json = await loadItems() // Obtaining the content of the exact cell we are looking for stockValue = json[0].content["$t"] // Create the widget let w = new ListWidget() // w.backgroundColor = new Color("#000080") // Add the value of the stock to the widget t = w.addText(stockValue) t.textColor = Color.black() t.font = new Font("Avenir-Heavy",10) Script.setWidget(w) Script.complete()