A Budget Budget App

I have a very simple budget app I wrote a few years ago that I use to track spending. I recently wanted to add a feature (a short description in addition to the amount spent) but soon I started thinking about the actual task and it didn't seem fun at all. I'd have to remember how it worked, remember how the framework I was using worked. I would have to remember how I deployed it. And then I'd have to write the feature. All told, it wasn't that much work but no work sounded even better. And since there were features I really didn't care about any more, decided I would hack the functionality of the entire thing into a google form and go on with my day. I even got to use another old project to make it even nicer. Here's how I did it:

  1. I made a google form with two fields: amount and description. I set up a spreadsheet to store information the information in. Google automatically adds a time stamp.

2. Published it and added it to my phone's homescreen so I can quickly add a time stamp.

  1. I created a second page in the spreadsheet it stores data in and wrote a little query to copy the data that gets written into the first sheet into my second sheet. So the sheet that the form is writing into is called "expenses" and looks like:

The following query in A1 of the second sheet copies this data over:

1
=query(expenses!A1:C512, "SELECT A, B, C")

I do this rather than just using the page with the expenses directly or copying them with simple references (like "=(expenses!A!)") because every time data in input into the the form it inserts a new row in the spreadsheet that captures data. This breaks formula references. So the above gives me a way to maintain references in my other formulae because the query copies an entire "area" over.

Then in columns D and E I extract the week number with:

1
=if(A2, WEEKNUM(A2,2), "")

And the year number with:

1
=if(A2, YEAR(A2), "")

And in two other cells product the current week and year using something similar to the above but with the NOW() function:

1
=WEEKNUM(NOW(),2)

I store these in F2 and F4. Then produce my weekly total with the following query:

1
=query(A2:E500, "SELECT SUM(B) WHERE D = " & F2 & "AND E = " & F4 & " label SUM(B) 'weekly total'")

The whole ugly thing looks like this:

Then I use an android app I made called Cellout which lets me display a cell from any google sheet on my phone's homescreen.

That's it. More functionality in the world, less code.

2018-11-07