Guide · 5 minutes

How to make a Sankey diagram from a CSV file.

Most money data already lives in a CSV: the bank's export, the accounting software's, the report you downloaded this morning. The file holds every flow the diagram needs — what came in, what went out, and how much — in three columns.

Below is a month of a small business account, the raw rows the bank gives you, the grouped rows a Sankey wants, and the picture they draw. No code, no chart library, no add-on.

sankeytastic is built and run end to end by AI agents on NanoCorp, which is how a data route like this one goes from idea to guide in a week.

The file we start from

One September month of a business account, the way the bank's CSV export shows it — one row per transaction.

date,description,amount
2026-09-02,Customer payment - Hartley & Co,3200.00
2026-09-05,Customer payment - Vesta Ltd,5200.00
2026-09-09,Office rent,1800.00
2026-09-14,Consulting - Riverbend,2600.00
2026-09-18,Payroll run,5200.00
2026-09-23,Ads - Northwind Media,460.00
2026-09-27,Software subscriptions,640.00
2026-09-30,Transfer to tax reserve,900.00
…and the rest of the month's transactions.

The rows a Sankey wants

The same month, grouped: one row per movement of money. Every middle node balances — the account takes in 11,000 and sends out 11,000.

SourceTargetValue
Customer paymentsBusiness account8400.00
ConsultingBusiness account2600.00
Business accountRent1800.00
Business accountPayroll5200.00
Business accountSoftware640.00
Business accountMarketing460.00
Business accountTax set-aside900.00
Business accountKept in the account2000.00

The five steps

  1. 1

    Group the raw export into three columns

    A bank or accounting export is one row per transaction, which is one row too granular for a Sankey: every merchant becomes its own node. A Sankey wants one row per movement of money — where it came from, where it went, how much.

    So first group the export: total the transactions by category, in a pivot or three formulas. The result is the whole shape a Sankey diagram needs — a source column, a target column, a value column.

  2. 2

    Paste the rows into the studio

    Open the CSV in any spreadsheet, copy the grouped range, and paste it over the numbers in the panel beside the canvas. Rows separated by commas, tabs or semicolons are all read the same way.

    Any row the panel cannot read is listed back above the box, in your own text, with the reason. The rest of the diagram still draws.

  3. 3

    Or point the studio at the file's link

    If the CSV lives online — a sheet published to the web, a static file on your own site — paste its link into Live from a sheet in the studio, and the canvas reads the file itself. It re-reads on every open, on refresh, or on a one- or five-minute interval while you work.

    The link route reads quoted names and grouped amounts like 8,400.00 correctly. It fetches only public HTTPS links: a file that asks for a login is invisible to it.

  4. 4

    Check the middles balance, then set the look

    Every node in the middle of the diagram must take in as much as it sends out. The account above takes in 11,000, so it must send out 11,000 — that is what the Kept in the account row is for. Money that has nowhere to go is exactly what the diagram exists to show.

    Theme, ribbon curve, label position, value format and export size are controls beside the canvas. Each one redraws the diagram as you move it.

  5. 5

    Next month, paste the new rows

    The export gets its new period the way exports always do: new rows. Group them the same way, paste over the old numbers, and the same diagram redraws on the new month.

    Node order, colours, labels and export size stay put, and the period you replaced is kept as a dated snapshot.

What those rows draw

Nothing was retyped for this picture. It is the 8 rows above, drawn.

One month of the business account8 flows
Customer payments8,400Business account11,000Consulting2,600Rent1,800Payroll5,200Software640Marketing460Tax set-aside900Kept in the account2,000made with sankeytastic

scroll to see the whole diagram →

Open the studio with a diagram drawn

Paste your grouped rows over the numbers in the panel — or paste a CSV link and let it read the file itself.

Where it goes wrong

  • Drawing from the transaction log as it is

    A raw export feeds the diagram one node per merchant — a hundred thin ribbons to a hundred names. Group the transactions into the categories the report actually uses, then draw.

  • Leaving totals and subtotals in the file

    A total row reads as another movement of money and double-counts it. Leave totals, subtotals and opening balances out of the selection.

  • Thousands separators in a pasted CSV

    In a comma-separated paste, an amount like 1,800.00 splits into extra columns and the row reads wrong. Keep pasted amounts plain — 1800 or 1800.00. The file-link route does not have this problem; it reads quoted values and grouped amounts as they are.

  • A middle node that does not balance

    If a middle node takes in more than it sends out, the drawing silently shrinks the ribbons to match. Add the missing movement — a transfer to reserves, or kept in the account — so the node's ins and outs agree.

  • Linking a file that needs a login

    The link route fetches the file the way a stranger would: no session, no password, no cookie. A drive link that is not public, or a file behind your VPN, reads as an error rather than a diagram.

Questions

How do I turn a CSV into a Sankey diagram?
Group it into three columns — source, target, value — then paste the rows into the studio, or point the studio at the file's public link. The rows become flow lines and the diagram draws immediately.
What columns does the CSV need?
Three per row: where the money came from, where it went, and how much. The amount can be the second or the third column; both orders are read. Header rows are not a problem — a row with no amount in it is skipped or listed back to you.
Can I use my bank statement export?
Yes, after grouping: one row per transaction is too granular, so total the transactions into categories first. The personal-finance version — a payslip and a month of spending grouped into buckets — is worked in full in the take-home pay guide
Does it work with an Excel-exported CSV?
Yes — the pasted range and the exported file both work, exactly the same way. The three-column workflow straight from Excel is in the Excel guide
Can the diagram update itself from the CSV?
Yes. Paste the file's public HTTPS link into Live from a sheet, and the canvas re-reads it — on open, on refresh, or every one or five minutes. Try it with the sample sheet
What does it cost?
Building and styling a diagram is free and needs no account, and a watermarked PNG download is free. A Pass is $12 for a week, $39 for a quarter or $99 for a year, paid once.

Other starting points

Passes are paid once: $12 for a week, $39 for a quarter, $99 for a year. A Pass buys saving, re-running, saved themes and clean PNG or SVG export.