This widget is used in combination with a google sheets file to pull data to display on your homescreen using Scriptable
The code has the name of the variables mainly in italian, but it's not that hard to change them if you need to
- The widget supports both light and dark mode
- Where there's need to maintain the layout the numbers that are over 1000 are shortened with "k" indicator
- You can change the currency on line 54, default is euro (€)
This won't affect the numbers because there's no calculation for currency exchange, it's just visual
const modificatori = { currency: '€', thousands: 'K', million: 'M' }-
Find and copy your sheet id:
- Open your spreadsheet file
- Find and copy the sheet id like shown below
https://docs.google.com/spreadsheets/d/this_is_the_sheet_id/edit#gid=randomnumbers - Replace YOUR_SHEET_ID on line 76
const sheet_id = 'YOUR_SHEET_ID' -
Replace the number values inside this portion of the code on lines 127-131 if they don't match the correct values from your spreadsheet (order: left -> right appear in widget top -> bottom)
- the first row represents the values from the income categories
- the second row represents the values from the expenses categories
- the last row represents the income totals, expenses totals and the difference between these two
let googleSheetsData = { entrate : [JSON_Key(9), JSON_Key(17), JSON_Key(25)], uscite : [JSON_Key(7), JSON_Key(15), JSON_Key(23), JSON_Key(31), JSON_Key(38), JSON_Key(44), JSON_Key(50), JSON_Key(56), JSON_Key(62), JSON_Key(68), JSON_Key(74), JSON_Key(80)], totali : [JSON_Key(86), JSON_Key(87), JSON_Key(88)] } -
To find the correct values you can download 'Jayson' from the app store and open inside the app the url below (remember to change the sheet_id) to the all the data and determine which index you need
https://spreadsheets.google.com/feeds/cells/sheet_id/1/public/full?alt=json - On the homescreen of your iPhone add a Large Scriptable widget and select the Budgeting script
If you want to use the same template that i use here's the link (make a copy in your drive):
https://drive.google.com/drive/folders/1RItAQHRAxMEPS14VeN2frJ1XuyCJ7bLh?usp=sharing
Credit for this file goes to this girl on youtube
- Make a copy of the template in your Drive
- Publish your Google Sheet, File -> Publish To Web
Enjoy your widget