BankStatementScan
English

CSV injection in bank statement exports

Bank CSV descriptions starting with =, +, - or @ can run as formulas in Excel. Import them as text, keep amounts numeric and test a harmless sample.

CSV injection (also called formula injection) happens when a text field in a CSV starts with =, +, -, @, a tab or a line break, and the spreadsheet that opens the file treats it as a formula instead of text. In a bank export, the risky fields are descriptions and payment references, because part of that text is typed by other people. Import those columns as text, never by double-clicking an untrusted file, and keep the amount column numeric.

The text-versus-number decision is one step of any bank statement CSV import into Excel. The same rule applies to descriptions extracted when you convert a scanned bank statement to Excel or CSV: they are data, not instructions to your spreadsheet.

What is CSV injection, and why does it reach bank statements?

A CSV file has no cell types. It is lines of characters separated by commas, and quotation marks only mark where a field starts and ends (RFC 4180 describes the format). When a spreadsheet opens the file directly, it decides each cell’s type itself, and a field beginning with a formula character can be evaluated. OWASP’s CSV injection page lists the leading characters =, +, - and @, plus tab, carriage return and line feed, and notes that some locales also treat full-width variants such as = as formula starts.

Bank files are exposed in a way generic CSVs are not:

  • Payment references are written by the payer. A transfer reference or remitter name is typed by whoever sent the money, and it appears in your statement and your export.
  • Card descriptors come from merchants. The text shown for a card payment is set on the merchant side, not by you or your bank.
  • Minus signs are legitimate in amounts. -12.00 is an ordinary outflow. A protection rule applied to every field starting with - would turn your amounts into text and break every total.

So the goal is not to “sanitize the file”. It is to make sure text columns stay text and number columns stay numbers, on the route your workbook actually takes.

How to open a bank CSV without running formulas

  1. Do not double-click a CSV you did not create. Save it, keep the original untouched, and work on a copy.
  2. Preview the raw text first. Open the copy in a plain text editor and search the description and reference columns for fields that start with =, +, @ or -. Note them; do not delete characters.
  3. Import through Text/CSV, with types you set. In Excel’s Text/CSV import (Data tab), transform the data, remove any automatic type step, and set description and reference columns to Text. In the older text import wizard, mark those columns as Text. Menu names vary with version and language.
  4. Set amount columns to a number type separately, with the decimal convention of the file, so -12.00 stays a negative number.
  5. Never accept a prompt to enable content, update links or start another application to make a bank file “work”. An ordinary statement export needs none of that.
  6. Test the saved copy, not just the first view. Save, close and reopen through the route the recipient will use; then check the same cells again.

Bank descriptions should arrive as the exact text printed on the statement, never as formulas. BankStatementScan turns scanned or PDF bank statements into Excel or CSV with each row reviewed beside its source page, text kept as text and amounts as numbers, plus a balance check. Find out how each row stays linked to its page for review.

See the synthetic example

Test your import route with a harmless sample

Before importing real transactions, build a three-row fictional file and run it through the exact route you plan to use. The formula used here is a sum of two numbers: it does nothing if evaluated, which is the point.

Reference,Description,Amount
TX-71,"=1+1",-12.00
TX-72,"+Monthly fee",-3.00
TX-73,"Ordinary transfer",20.00

The route passes only if:

FieldSourceExpected cellFail signal
Description=1+1Four text charactersThe cell shows 2 or holds a formula
Description+Monthly feeExact text with the plus#NAME? or a missing plus
DescriptionOrdinary transferExact text—
Amount-12.00Number −12.00Text, or the sign removed
Total of amounts+5.00Any other total

A total of +5.00 with the first description shown as 2 still fails: money checks do not prove that text survived. Note also that the wrapping quotes in "=1+1" are CSV syntax. The expected cell content is =1+1, not "=1+1"; quoting alone does not declare the cell as text.

Add more cases if your exports contain them: a description starting with @, one starting with a hyphen (-ADMIN FEE), and a description containing a comma inside quotes ("Fee, monthly"), which must stay in one column.

If you produce CSV files for others

If you pass bank exports to a bookkeeper or load them into another system, the question changes: you decide how the file is written. OWASP describes a general approach (quote every field, escape internal quotes by doubling them, and prefix a single quote to fields that start with a formula character) and warns that no sanitization method works for every spreadsheet and every downstream consumer, and that some protections are undone when a file is saved and reopened.

Two consequences for bank data:

  • Apply any prefix to text columns only. A prefixed amount is no longer a number.
  • Keep the original description in a separate field or file. A display copy with '=1+1 no longer matches the source text, so later exact matching or audit comparisons fail even though no money changed.

If the receiving system expects exact data rather than a readable workbook, agree on that before adding any prefix, and send the import settings with the file.

Limits

This checklist verifies one import route on one application and version; it is not an audit of every file you will receive, and it does not make an arbitrary spreadsheet safe to open. Record the application, the route, the column types and the result of the sample test. If the destination cannot keep =1+1 as text, change the route rather than deleting characters from the bank’s descriptions.

Questions

Is CSV injection a risk when I only open my own bank’s export?

The bank creates the file, but not all of its text: payment references, remitter names and merchant descriptors come from third parties. Importing description columns as text, on a route you have tested, addresses it.

Should I remove the = or + at the start of a description?

No. Deleting characters changes the source description. Keep the text exactly and control the cell type at import.

Why does my amount column turn into text after I protect the file?

A rule that prefixes every field starting with - also catches negative amounts. Apply it to text columns only and set amounts to a number type.

Text fields need the same care elsewhere: CSV UTF-8 garbled characters in bank descriptions, bank references in Excel with long IDs and leading zeros, and Excel negative numbers in parentheses and minus signs.

Sources

BankStatementScan turns bank statement PDFs, including scans, into Excel or CSV: every transaction sits next to its source page and the closing balance is recalculated.

Request access to BankStatementScan.

Leave your work email to get access to BankStatementScan. No account or payment is created at this stage.

Submitting sends your email and visit/context information to BankStatementLab infrastructure for BankStatementScan. No account, payment or automatic email is created. Privacy.