Filling a PDF from Excel

One row per copy, one column per piece of information. Plus one long-standing problem with CSV files that nobody warns you about until it is too late.

What the spreadsheet should look like

The first row holds the headers, meaning the name of each column. Those are what you will see when mapping columns to fields, so it is worth making them readable. Name and Amount beat col1 and col2.

Every row after that produces one copy. Thirty rows, thirty PDFs.

An empty cell is fine; the matching field is simply left blank on that copy. What matters is that the column exists.

Prefer XLSX to CSV

The .xlsx format is what Excel, LibreOffice and the online spreadsheets use natively. It carries its own encoding, so there is nothing to guess and accented characters arrive exactly as you typed them.

A CSV is a plain text file. It says nothing about how its columns are separated, nor what encoding it was written in. Both have to be guessed, and that is where the trouble starts.

The CSV encoding trap

CSV stands for comma-separated values, but the comma is not universal. In French, German, Spanish and most of continental Europe the comma is already the decimal separator, as in 1 234,56. Excel in those languages therefore exports CSV with a semicolon, and usually in a legacy Windows encoding rather than UTF-8, sometimes with an invisible marker at the start of the file.

A tool that assumes “comma and UTF-8”, which is the common assumption, then gets either one enormous column or text where every accented character has been replaced by two odd-looking ones.

What you typedWhat shows up
SociétéSociété
MüllerMüller
NguyễnNguyá»…n

The awkward part is when you find out. Usually at the end, on the finished documents, once three hundred PDFs already exist.

Publiposter works out the separator and the encoding, shows you what it found, and lets you override it when the reading is wrong. A preview of the table appears before anything is generated. That is the moment to check that the accents survived.

Exporting cleanly

In Excel, Save As and then Excel Workbook (.xlsx), and there is nothing else to do. If CSV is forced on you, look for the CSV UTF-8 option where your version offers it, since that one is unambiguous.

LibreOffice Calc opens a dialog on export with a character-set menu. Choose Unicode (UTF-8).

Numbers, dates, amounts

What sits in the cell and what should appear on the document are two different things. Formatting is applied when the field is filled, which saves preparing one column per presentation.

How many rows

Three thousand is fine. Generation runs in batches, progress is shown, and you can stop partway without losing what is already done. The size of the archive depends mostly on the source PDF: a one-page form is a few dozen kilobytes, a colour scan far more.

Import a spreadsheet and see

Page last revised