Spending from a bank statement → Samlla
- What it measures: your total spending each day, from a CSV file exported by your bank.
- What you need: a Samlla account (Free is enough), consent to processing health data in Samlla, a Samlla API key, a CSV account history from your online banking, and a computer with Python 3.
- Runs on: your computer. You run the script yourself whenever you download a new file — for example, once a month.
- Time: about 15 minutes.
- What leaves your computer: only the date and the daily total. No descriptions, payees, account numbers, or balances.
Copy the whole block below and paste it into Claude, ChatGPT, or another AI assistant.
I want to see in Samlla how much I spend each day, based on the CSV
account history I download from my online banking. Build me a small
script that I run on my own computer whenever I download a new file.
I am not a programmer: choose the simplest solution and guide me step by
step. Reply in my language.
Technical surface
- One Python 3 file using only the standard library, with no packages to
install. I run it with a single command, `python3 <script> <file.csv>`,
with no questions while it runs.
- The script reads the Samlla API key from the `SAMLLA_API_KEY`
environment variable. Never put the key in the code, in a file, or in a
log.
- Do not ask me to paste the whole statement. Ask only for the header
row and one sample row in which I replace the description, payee,
account numbers, and balance with "X". Use them to identify the date,
amount, and currency columns; if you are unsure, ask.
- Banks often export CSV in Windows-1250 encoding, with a decimal comma,
a space between thousands, and a semicolon or comma between columns.
Information rows may precede the header: find the header row by its
column names and skip empty rows. The same column name may appear more
than once.
What should happen
- Samlla gets one number per day: that day's total spending in the
account currency, as a positive number rounded to 0.01.
- The date is the operation or transaction date when the file has one;
otherwise the booking date. A day runs in my time zone.
- Only debits count: negative amounts or a "debit" column, depending on
the format. Skip incoming payments. Skip transfers between my own
accounts when I name them during setup: by a name or phrase from the
description, or by the last 4 digits of the account. I never give a
full account number in our conversation; do not ask for one. Keep the
phrases and endings inside the script, on my computer. If the script
shows an account, for example so I can point out mine, it computes the
last 4 digits locally and shows them masked: "•••• 1234".
- Sum in the account currency. Skip rows whose amount is in another
currency and report how many there were, without converting exchange
rates. A card payment abroad that the bank already booked in the
account currency counts normally.
- Holds (transactions not booked yet) are not spending yet: skip them and
report how many there were.
- The script changes only days within the range of dates in the file,
from the earliest to the latest. Days outside the file stay untouched.
- A day without spending gets no entry: a missing entry means 0. If the
total of a day that already has an entry drops to 0, the script deletes
that entry.
- Importing the same period again corrects existing entries and creates
no duplicates.
- A file read error or a row that cannot be understood is not 0: the
script stops with a message before it writes anything.
- Everything goes into one tracker, "Spending", with one number metric
whose unit is the account currency code, for example PLN. If the
tracker does not exist, the script creates it.
- Respect my plan's history window (90 days on Free): skip older days and
report how many. Wait 4 seconds between writes.
- At the end the script prints a short summary: how many days it added,
corrected, and deleted, and how many rows it skipped and why.
Privacy
- Only the date and the daily total go to Samlla. Descriptions, payees,
account numbers, and balances must not reach Samlla or any log, and
reach our conversation only in the anonymized setup row. At most the
last 4 digits of an account number reach our conversation.
Spirit
This is observation, not a budget. No limits, thresholds, alerts,
"unnecessary spending" categories, or judgments like "too much". Samlla
shows the history; the conclusions are mine.
How I will check that it works
After the first run I will compare the totals of 2–3 days in Samlla with
the statement. A second run on the same file should change nothing.
Before you write any code, ask me at most 3 questions at a time. Always
ask for the header row with one anonymized row and for a name or phrase
from the description, or the last 4 digits of the account, that marks my
own-account transfers, and put my answers into the script so I do not
have to edit it. If I answer "default" to the
other questions, assume my computer's time zone, the account currency
shown in the file, and the Free plan.
Samlla's technical facts (API, response shapes, limits, pitfalls) are at https://samlla.app/llms.txt. Read them before writing code and follow them instead of guessing.