How to bulk edit expenses in Toshl?
I transformed entries from multiple categories into ones with single category and multiple tags
Toshl doesn't have bulk edits. Chances are you probably already know this, especially if you're coming here from a Google Search.
I've recently switched personal finance tracker and imported my all-time data. I also got all the categories from the old app, which is ok. However, in the old app, I haven't used tags. Only categories. Here in Toshl, I see I could start using tags as well. Another thing, now my pool of categories was a mix of old and new ones, so I wanted to tidy it up.
So I start looking for a bulk update option on my phone. Couldn't find it. It has to be available in the web app, I thought. Nope. There isn't a bulk update feature. And as you can see, it's been on their feature to-do list for quite a while 😅
I have entries for over quite a period that belongs to three categories:
Vehicle insurance and
In the old app, there was a category hierarchy system, so I used them directly without tags. Now I would like to put them all into one category, "Insurance" and to have three tags attached to them respectfully. Tags would be:
But, I want to keep the metadata. After I finish, an expense that was in the "Property insurance" category, will be in the category "Insurance", having the tag "Property" attached to it.
Manual way to the rescue
I found a way how to do a bulk edit but it requires additional steps, so I wanted to write it down here for future reference, but also to give you an idea of how you can do it too. I'll put as many details as possible so you can follow.
Also, bear in mind that you can mess things up along the way, so be careful. This isn't Toshl's official guideline nor I would like to feel responsible for your data loss. As they say, this is for information purposes. Read all the steps before you start doing anything. You might get a better understanding of the process and maybe something else will come to your mind.
export entries you want to edit as a CSV
edit CSV and put whatever you like
delete exported entries in Toshl
import edited entries
check if you screwed up something
Complete step by step list
1. Take a snapshot of your current balance
As we're doing a mass edit, something might go wrong. Don't worry, it can also go just fine. But how can we prove that? Well, simply by comparing before and after numbers. That's why it's important to write down your balance. You could also take a screenshot, whatever works for you.
2. Create a new category
A fresh category will be useful, so we can make a clean merge. In my case, I've created the "Insurance" category. I'll explain in the end why it's better to have a new category, instead of reusing one of the three existing categories (i.e. merge the first two categories into a third one).
3. Check the sum of all records in a category
This step will also help with further validation. As you can see, we're paying attention and putting a lot of checks along the way. When you go to "Edit categories" and open one, you can see the "List of expenses in the category" link. This will give you an overview of all entries within and you can check the total sum by switching to the "By Category" tab. Write down this number as well, since we will compare it in one of the next steps
4. Export the expenses you want to bulk edit
In the export menu, select the proper category and proceed with exporting. A CSV file will be enough. Make sure that you
export from all accounts (if it is relevant);
set a period to "all time" to get all of the entries and
uncheck "Incomes", so it doesn't include them in the file.
Anything done wrong from the list above may cause some kind of data mismatch. E.g., data not exported from XY account is later deleted in the app; exported only for last month, but deleted all; you reimport the incomes unnecessarily and thus having your data doubled.
5. Open the CSV with your favorite editor and start editing
Be it Google Sheets, raw text edit or something else, open the file and do all the changes you want. In my case, I went with Google Sheets, as I wanted a tabular view. That way I could apply my changes by dragging the values in the cell. There was one extra step to convert the CSV data into a tabular view, but I'll skip that here.
My only change was to write the name of the tag next to the category name. I didn't mess up with anything else, especially with the categories. This will come in the next steps.
Another reason why I did it in Google Sheets is to quickly sum up the expenses. This is something you can't do automatically if you're editing a raw CSV file. I compared that sum with the one from step #3, to make sure I'm on a good path.
After that, export your CSV file. If you're a freak like me, you'd like to check if anything was messed up, e.g. date format and similar things. Those can go nasty when converting from one file format to another.
6. Delete the category you've exported (and the records within)
Yes, you'll need to delete the category completely and all the expenses you have within. I know, scary. Toshl will even warn you, and ask you to confirm it by typing the password again. And pay attention here, as this is a step where you can't go back if you haven't properly done steps before.
We're deleting this, because we'll import the same entries, slightly modified, in the next step.
In case you want to see if the process is working well, you could proceed to the import without deleting the entries. That way you'll see double entries once imported but it will help you verify that the dates are correct (grouped by day), and also see if the changes are what you expected them to be. You'll see both entries next to each other, easy to compare. But, after all the checks, you'll still have to delete the entries from that category and do the import one more time, to have only updated entries.
7. Import the CSV file.
In Toshl import documentation, and when I talked to their support, they advise people to create a new account where they can import things. The logic is simple, if you screw up something, you can delete that account while keeping your main accounts intact. So, I've created an account "import-tags" and proceed with the import process.
Did I need a new account for this? Well, yes and no. Turns out, the freshly imported file will match your existing account, and the entries will go directly there, not in the "import-tags" account. If you exported data from a "Bank" account, it will re-appear in the "Bank" account after import. However, you do need to select a destination account for your import. So I stuck to it, in case something would have gone wrong.
8. Verify the category you've just imported
Open the category and check all the records in it, same as in step #3. Yes, it is the category you deleted, but this import recreated it for you.
Take a brief look if the entries are on the proper dates, and most important (the reason why we did this) if they have the proper tags attached.
At this point, your entries will still have the old category, don't worry, we'll come to that in a minute.
While you're here, it's a good idea to double-check the total sum of selected entries and compare it to the one in #3.
9. Merge the old category with the one created in #2
Go to "Edit categories" in your expense view to have all of your categories. You'll notice a new tag dangling without a category. That's also one of the signs that our import went fine. Toshl lets you do the merging and moving with drag and drop, so the next thing we are going to do is
Drag "Property insurance" on the freshly created "Insurance" category
Also, assign the "Property" tag to the "Insurance" category.
With the category merging, all the previous entries that had the "Property insurance" now have the "Insurance" category.
The reason why we moved the tag into the "Insurance" category is only to bind that tag and prioritize it the next time we create an "Insurance" expense.
I owe you an explanation of why it's better to create a fresh new category, as mentioned in step #2. If you have categories A, B and C, create a new parent category P and do this process so you can have tags A\, B* and C* in category P. In case you transform category A (and later B) and merge it to C afterward (with the final step of renaming C -> P), you'll have a P category with tags A* and B*, but the remaining entries won't have any tags. This is ok if your C category is already kind of a catch-it-all category and its entries don't have to be tagged.*
10. Check if your account balance is the same as before
Now to do a final check. Your account balance, in total and separated, should remain the same. During the process of deleting and importing the amounts will change, as there are removing and restoring data steps in place, but once you finish, the numbers should be the same. If not, then you haven't done all the steps properly. If this is the case, sorry, you're on your own to figure out what went wrong.
11. Rinse, repeat
I did this a few times. First when I tested it, then I changed my real entries and it works. However, there are some repeating steps that I think I will try to minimize.
Doing things one by one can give you more control, as you can stop and check the changes. Also, the changes are coming in smaller batches so they should be easier to roll back.
It's doable, but still requires a lot of steps and a sharp mind. Don't do this when you're tired and can't see numbers properly.
But, it's ok if it's a one-time action (setting up an account, doing major changes).
Editing CSV files can open endless possibilities when it comes to bulk editing Toshl records. You just need to put everything back properly once you finished playing.
I still have to re-organize my bills category, and I have plenty of them. I will think about reducing the steps so I don't have to do them one by one. Haven't tested it, but it should be possible to export multiple categories, edit them all at once and import them in the same way as above.
That would be it for now.
Drop a comment if this article helped you set up your Toshl account.