Hi all, allow me to share a Google Sheet for maintaining your vehicle values automatically:
To use this code, you need to create a manual account for each car as follows:
Account name - enter a nickname for your car such as “My Corollita”
Account number: enter “vin=” followed by the VIN of your car, e.g. vin=3GTUUDED4RG154891. This is essential because it will allow the script to detect vehicle-related accounts.
Institution: No Institution
Class: Asset
Type: Other
Date: acquisition date of your vehicle
Balance: the price you paid for the vehicle
Once you entered your vehicle(s), you’re good to go. All you need to do is copy the google script code to your sheet. In the sheet above select Extensions → Apps Script, then select all code and copy it to the clipboard, then go to your sheet, select once again Extensions → Apps Script and paste the code into your script page.
Refresh your sheet and you’ll see a new bar menu at the top called “Actions”. Chose Actions → Update Vehicle Values and a new line will be added to Balance History for each of your vehicles.
To automate tracking, you need to create a trigger that calls function “updateVehicleValues” every week or so.
Just noting that the Apps Script does make assumptions on the Balance History sheet column order and content, so people are aware.
// Use 13 instead of sheet.getLastColumn() because last column is reserved and should not be copied
const rowData = sheet.getRange(old_value_row, 1, 1, 13/*sheet.getLastColumn()*/).getValues();
@Mark.S Thanks. I wonder what sort of guarantees for compatibility can be counted on. Should I have code for searching column titles instead of hardcoded indices?
I have some code along these lines for something unrelated to Balance History, if it helps you to leverage something, although I’m sure there are a few ways to accomplish this.
And remove the special last column code - maybe only write the required, standard columns, instead of the entire row?