The reason this is annoying is that a CSV has no page. It is an unbounded grid; a PDF is a stack of fixed rectangles. Every conversion has to decide where to cut, and every tool that does it badly makes the same decision: cut wherever the paper runs out, then let the remaining columns fall off the right-hand edge.
So the useful question is not "how do I convert", since almost anything will produce a file, but which columns and which rows are actually going into the PDF. Answer that first and the conversion is trivial.
Before converting: cut the file down
A PDF of 40,000 rows is not a document, it is a mistake with a file size. Nobody opens page 612. If the recipient needs every row, send them the CSV.
A PDF is the right format when the output is meant to be read rather than processed, which means it should be:
- Filtered. The rows relevant to this recipient, not the whole export.
- Narrowed. Six to ten columns fit on a landscape A4 page legibly. Fifteen do not, at any font size a person will read.
- Summarised, often. A GROUP BY that turns 40,000 rows into 30 is usually the document that was actually wanted.
Doing this before the conversion is the entire difference between a usable report and 600 pages of truncated grid.
Orientation and column width
Two settings decide whether the result is legible, and both default wrong.
Landscape, always, unless the file has fewer than five columns. Portrait A4 fits roughly six narrow columns; landscape fits ten.
Scale to fit width, not to a percentage. Every spreadsheet has this and almost nobody finds it: in Excel it is Page Layout → Scale to Fit → Width: 1 page. Without it, columns eleven onward are printed on their own set of pages after the last row, which is how you end up with a 40-page PDF of a 12-page table.
Then two things worth setting once:
- Repeat the header row on every page. Excel calls it Print Titles → Rows to repeat at top. A table whose header appears only on page one is unreadable from page two.
- Turn on gridlines. Off by default when printing, and a wide table without them is very hard to read across.
The routes, by situation
From a spreadsheet, on a desktop
Open the CSV, apply the settings above, then Print → Save as PDF. This is the best-looking output of any method here, and the only one where you can put a title and a page number on it without writing code.
Watch the import, though: opening a CSV in Excel converts anything that looks
like a date, and a PDF is a permanent record of that mistake. A column of order
IDs that arrives as 43831 was 2020-01-01 in the file. Import as text if the
data has IDs, leading zeros, or long numbers in it.
From the command line
For a plain, correct table with no styling decisions to make:
csvlook data.csv | enscript -B -f Courier8 -o - | ps2pdf - out.pdf
More practically, if you want control over the layout, go through HTML. Every system has a headless browser and browsers are excellent at paginating tables:
csvtomd data.csv > table.md
pandoc table.md -o out.pdf
The advantage of the HTML route is that @page { size: A4 landscape } and
thead { display: table-header-group } in a stylesheet give you exactly the two
things spreadsheets bury in dialogs: orientation and repeated headers.
From a phone
This is where the conversion actually comes up: the file is in your email, the person who needs it wants something they can read on a screen without a spreadsheet app, and you are not near a laptop.
The important part is the same as everywhere else: filter and narrow before exporting. A phone-sized PDF with five columns and forty rows is a good deliverable. A phone-sized PDF of the whole file is not.
Converts to PDF directly, with the export's columns and styling chosen rather than inherited, and the visual filter editor or a SQL query narrows the file to the rows worth printing first, which is the step that decides whether the PDF is readable.
What it doesWhen a PDF is the wrong answer
Three cases, and they cover most of the requests.
"So they can open it without Excel." They can already: a CSV opens in Notepad, TextEdit, any browser, Google Sheets, Numbers, and every phone. If the worry is that it will look bad, the fix is usually a narrower file, not a different format.
"So they can't change it." A PDF is not read-only in any meaningful sense. It is trivially editable and trivially extractable. If the requirement is integrity, the answer is a signature or a checksum, not a file format.
"So they can use the data." A PDF is the worst possible container for tabular data, and getting it back out is a task with a whole industry attached. If the recipient will do anything with the numbers, send the CSV and a PDF summary alongside it.
The genuine cases for PDF: something to be printed, something to be archived with fixed pagination, something to be attached to a formal record, or something whose layout must survive being forwarded.
Making it look like a report
Four things, in order of how much they improve the result:
- Right-align numbers, left-align text. Nothing else changes legibility as much, and it is one setting.
- Fix the decimal places. A column that mixes
1.5and1.4999999reads as sloppy and is usually a float artefact rather than real precision. - Add a header and a footer. Title, the date the data covers (not the date you printed it), and page numbers.
- Say what the file is. One line at the top: the source, the filter that was applied, the row count. Six months later this is the difference between a document and a mystery.
Where the file needs fixing before it goes out, whether that is a rounded column, a computed total or deleted rows, the formula columns handle it on the phone, and the result saves inside the CSV so the numbers are the same in whatever prints it.
What it doesCharts instead of tables
Worth asking before converting anything: does the recipient want the rows, or the shape? A trend across twelve months is a line, and a table of twelve months is a worse line that takes longer to read.
The strongest version of this document is usually a chart on the first page and the summarised table behind it, which is a two-minute job in any tool that can produce both, and considerably more useful than either alone.