Pivot Table Online
A real pivot table, built from your CSV, in this tab. Values from one column go down the side, values from another go across the top, and every cell counts, sums, averages, or takes the smallest or largest of the rows behind it. The dropdowns fill themselves in from your own column names. Free, commercial use included, and nothing is uploaded.
Need to filter or clean the rows first? Open the app
A pivot without the spreadsheet, or the sign-up
The question a pivot answers is always some version of "how much of this, broken down by that". Sales by region and quarter. Tickets by assignee and priority. Hours by project and month. Rows by status. The CSV in front of you already holds the answer, one transaction per line, and the only work left is the grouping.
Doing that in a spreadsheet means importing the file, watching it mangle a leading zero or a date, selecting a range, opening the pivot dialog and dragging fields into four boxes. Doing it in Python means an environment, a read_csv, and a groupby whose syntax you look up every time. This page is the middle: pick a row field, optionally a column field, optionally a value to summarise, and read the table.
It is worth being plain about what is out there, because the alternatives all come with a condition. The best known hosted pivot tool wants an account before it will open anything. Another well known browser pivot is free for personal use and asks for a licence the moment the work is commercial. Most of the rest are the front door of a BI product. Here there is no account, no licence, no watermark and no quota, commercial work included, and the reason all of that is possible is that the file never reaches a server. Your CSV is read by JavaScript in your own tab.
- Data you are not allowed to upload. Payroll, patient records, customer lists, anything under an NDA. A tool that never transmits the file removes the question rather than answering it.
- A file too big for the spreadsheet you have open. Ten thousand transactions grouped into a five by three table is a second of work here and a slow import somewhere else.
- A quick count before you commit to anything. How many rows per status, per region, per owner. Leave the value dropdown alone and the table counts rows.
- A summary someone else needs. Copy pastes into a spreadsheet as cells, and the download is the pivoted table as CSV rather than a screenshot.
Worked example: twelve rows, and one number that catches people out
Here is sales.csv, twelve rows, small enough to add up by hand:
region,quarter,rep,amount
East,Q1,Ada,100
East,Q1,Grace,200
East,Q1,Alan,300
East,Q2,Ada,600
West,Q1,Katherine,50
West,Q2,Edsger,150
West,Q2,Barbara,250
North,Q1,Radia,80
North,Q1,Leslie,120
North,Q2,Ada,400
North,Q2,Grace,500
North,Q2,Alan,600
Set Rows to region, Columns to quarter, Values to amount, and Summarise by to Sum. The table comes back as:
region,Q1,Q2,Total
East,600,600,1200
North,200,1500,1700
West,50,400,450
Total,850,2500,3350
East in Q1 is 100 plus 200 plus 300. The row totals add across, the total row adds down, and the grand total of 3,350 is every amount in the file. Regions come out in alphabetical order rather than the order they appeared, so the same file always pivots the same way.
Now switch Summarise by to Average and leave everything else alone:
region,Q1,Q2,Total
East,200,600,300
North,100,500,340
West,50,200,150
Total,141.6666666667,416.6666666667,279.1666666667
Look at the East row. The two cells are 200 and 600, and the total is 300. The average of 200 and 600 is 400, so where does 300 come from? East holds four rows: 100, 200, 300 and 600. Their sum is 1,200 and their average is 300. The Q1 cell is an average over three rows and the Q2 cell is an average over one, so treating those two cells as equal contributors would weight a single sale the same as three.
That is the whole differentiator, and it is worth saying out loud because getting it wrong is the classic pivot bug. Every total in this table is folded from the raw counts and sums of the underlying rows, never computed from the cells above or beside it. The same holds vertically: the Q1 column total of 141.6666666667 is the six Q1 amounts summed to 850 and divided by 6, not the average of 200, 100 and 50. And the grand total of 279.1666666667 is all twelve amounts, 3,350, divided by 12.
The same file under Count, with the Values dropdown left on Count rows:
region,Q1,Q2,Total
East,3,1,4
North,2,3,5
West,1,2,3
Total,6,6,12
Twelve rows in, twelve rows accounted for. Above the table the widget prints what it actually did, in this case: Sum of amount, rows: region, columns: quarter, 3 groups from 12 rows. When the pivot on screen is not the one you meant, that line usually says why.
The four controls
The three dropdowns are empty until a file has been read, because they are filled from your own column names. Drop the CSV in first and they populate themselves.
- Rows is the field whose values go down the left. This is the only one that is never optional: with nothing chosen, the first text-like column in the file is used and the summary says which one that was.
- Columns spreads a second field across the top. Leave it on None and the result is two columns wide, a group and its aggregate, which is the shape you want for a plain breakdown by status or owner.
- Values is the column being summarised. Leave it on Count rows and every cell counts the rows in its group, which needs no numeric column at all and works on a file of pure text.
- Summarise by offers Count, Sum, Average, Min and Max. Count answers with the number of source rows in the group, whatever is in them. The other four read the value column and ignore rows where there is no number to read.
Two combinations get corrected rather than refused. Choosing the same field for Rows and Columns drops the column field and says so, since a field cannot sensibly be both axes. Choosing an aggregate while Values is still on Count rows counts rows, with a note telling you to pick a value column if you wanted a sum.
Gotchas worth knowing
- Formatted numbers are skipped, not guessed. A cell holding
1,200,$5orN/Ais not a number, so it stays out of the sums and averages and is counted in a warning above the table: 3 values in "amount" are not numbers and were left out of the sums. Reading them as zero would be worse than useless, because an average would sag and nothing on screen would tell you why. - Blank and zero are different answers. A group with rows but no usable numbers comes back empty under sum, average, min and max. A group whose values really do add to zero shows
0. Under Count both show their row count, because that question is always answerable. - Empty grouping values get a label. Rows whose row field is blank are grouped together under
(blank)rather than being dropped, and that group sorts before the named ones. If a fifth of your file lands in (blank), the file has a gap worth looking at rather than a pivot problem. - 200 columns is the ceiling. Point Columns at a field with more distinct values than that and the first 200 are kept, with a warning naming the real number. Rows are uncapped.
- Sorting is by value, not by size. Groups come out in ascending order of the grouping value, numerically when every value in that field is a number, so 10 lands after 9 rather than between 1 and 2. The pivot does not reorder itself to put the biggest total on top.
- Aggregates are rounded at ten decimal places. That is what stops a sum of 0.1 and 0.2 from printing as 0.30000000000000004. It is far past any currency, but a sum over thousands of decimal values can still carry floating-point residue in the last places, which is true of every tool that uses doubles.
- Duplicate header names are renamed before grouping. A file with two columns called
namegetsnameandname_2in the dropdowns, and a blank header becomescolumn_4after its position. Both are reported as warnings, so you know which of the two you just grouped by. - 100 MB is where this page stops. No row limit under that. Past it the widget offers the full editor, which streams the file rather than holding it all at once.
Frequently Asked Questions
Do I need an account to use this pivot table?
No. There is no sign-up, no email wall, no trial and no daily allowance. Commercial use is fine, which is worth saying because the two browser pivot tools people usually land on do not offer that combination: one asks you to register before it will open a file, and the other is free for personal use only. Nothing here is metered because nothing here reaches a server.
How is the row total on an average calculated?
From the underlying rows, not from the cells beside it. A row holding averages of 200 and 600 gets a total of 300 when the first cell covers three rows and the second covers one, because the total is the sum of all four values divided by four. Averaging the two cells would give 400, which is a number that describes nothing in your file. Every total in the table is folded from the raw counts and sums, so the same rule holds for the column totals and the grand total.
What happens to values like 1,200 or $5?
They are left out of the arithmetic and counted in a warning above the table, which reads something like: 3 values in "amount" are not numbers and were left out of the sums. Nothing is silently read as zero, because a zero would quietly drag an average down and you would have no way to notice. Strip the currency symbol and the thousands separator, or use the count aggregate, which counts rows and does not care what is in them.
Why is a cell blank instead of showing 0?
Because a blank cell means there was nothing to add up and a zero means the numbers added up to zero. Under sum, average, min and max a group with no usable numbers is left empty rather than filled with a misleading 0. Under count the same group shows its row count, since counting rows is a question that can always be answered. A group whose values genuinely sum to zero shows 0.
How many columns can the pivot have?
200 value columns, plus the row label and the total. Point the Columns dropdown at a field with more distinct values than that and the first 200 are shown, with a warning naming how many distinct values the field really has and confirming that the totals cover the columns on screen. Rows are not capped: going long is what a pivot is for, and a table 200 columns wide is a horizontal scroll bar rather than something you can read.
Can I download the pivot as a CSV?
Yes, and it is the whole table rather than the part on screen. The download is named after your file with -pivot on the end, and it holds the row labels, every value column, the row totals and the total row exactly as displayed. The copy button puts the same table on the clipboard in a form that pastes into a spreadsheet as cells rather than as one long line of text.
Does my file get uploaded?
No. This page has no upload endpoint. The CSV is read, grouped and totalled by JavaScript running in your tab, and it is gone when you close it. That is also why the dropdowns can only be filled in after the file is read: the column names come from your file, in your browser, not from a server that was told about them.
Related
Pivot your CSV
Free, no account, no upload, commercial use included. Pick the fields, read the table, take the CSV.
Back to the pivot table