Bulk-Create EAN-13 Barcodes from Excel and Print on A4
Turn a product list in Excel into EAN-13 barcodes in one go and print them as an A4 PDF in your browser. Covers fixing numbers shown as 4.9E+11, check digit errors, and how 3, 2 or 1 columns change the bar width against the 0.8–2.0× size range.
Contents
You want to relabel the products in a small shop, print labels for goods you deliver to a consignment store, or keep a sheet of barcodes for every item to speed up stocktaking. In most of these cases the product names and their EAN-13 numbers are already sitting in an Excel sheet. Typing each number into a barcode website, saving the image and pasting it into a document is tedious even for ten items, and beyond fifty the work of checking that no image went to the wrong product becomes a job in itself.
CSV to Barcode PDF creates barcodes from a chosen column of a CSV file and lays them out on an A4 PDF, with a caption such as the product name under each one. Besides JAN / EAN-13 it supports Code 128, Code 39, EAN-8, UPC-A and ITF-14. Everything from reading the CSV to building the PDF happens inside your browser, so the product list is never sent anywhere.
This walkthrough takes a 10-item product list made in Excel from CSV to PDF. After that it looks at the two errors that Excel-made CSV files cause most often, and at how to choose the print size.
Save the Excel product list as CSV
The product list in the example has product names in column A, EAN-13 numbers in column B and prices in column C. The numbers are kept as 12 digits, without the 13th check digit.
Product,EAN,Price
Canvas book cover A6,490000000001,1800
Canvas book cover B6,490000000002,1900
"Pen case ""navy""",490000000003,2400
Brass bookmarks set of 3,490000000004,1200
"Postcards winter,5 pack",490000000005,800
Letter set snow,490000000006,950
Mini notebook A6,490000000007,650
Masking tape 15mm,490000000008,420
Beeswax candle small,490000000009,1500
Tenugui towel mountains,490000000010,1600
In Excel, use Save As and choose CSV UTF-8 (Comma delimited). Even if a product name contains a comma or double quotes, Excel wraps it in "..." as shown above, so it loads without changes. Choose the UTF-8 variant rather than plain CSV (Comma delimited): the plain variant saves in the code page of your Windows region, and the tool’s Auto-detect (recommended) setting tells apart UTF-8, UTF-16 and Japanese Shift_JIS only. A product name with an accented letter saved in Windows-1252 will not be read correctly.
One more Excel setting matters. Depending on the regional settings of Windows, Excel writes semicolons instead of commas between columns (common in Germany, France, Spain, Brazil and Russia, where the comma is the decimal separator). This tool reads commas only. If your file comes out with semicolons, export the sheet from Google Sheets with File > Download > Comma-separated values (.csv), which always uses commas and UTF-8, or choose the comma as the field delimiter when saving in LibreOffice Calc. Encoding problems with CSV files in general, including how to tell Shift_JIS from a UTF-8 BOM, are covered in Python UnicodeDecodeError when reading CSV.
Load the CSV and create EAN-13 barcodes
1. Choose the CSV file
Open the tool and select the saved file under CSV file in 1. Load CSV data. It is loaded as soon as you choose it, and its content appears in the input box below. The box is editable, so you can also paste just a few lines and press Load entered CSV to try things out.
2. Choose the columns, format and layout
In 2. Choose columns and print settings, set the following.
- Leave Caption column number at column 1 (the product name). The column chosen here is printed in small type under each barcode.
- Leave Barcode data column number at column 2 (the EAN number).
- The first row holds the column names
Product,EAN,Price, so tick Skip the first row because it contains column names. It is off by default, and then the first row is treated as data. - Under Barcode format, choose JAN / EAN-13 (12 or 13 digits).
- Under Print layout, choose 3 columns × 8 rows (24 / page). A later section explains why three columns is the right choice for EAN-13.
3. Check the preview and save the PDF
3. Preview and create a PDF shows a table of the first five CSV rows and a preview of the first three barcodes. The 12-digit 490000000001 you entered appears as the 13-digit 4900000000016 in the preview. When JAN / EAN-13 is selected and 12 digits are entered, the tool calculates the check digit and appends it.
Press Create and save PDF to save csv-barcodes.pdf. Ten items fit on one page, each barcode with its 13-digit number and product name underneath.
I converted this PDF to a 150 dpi image and read it with ZBar, an open-source barcode reading library. All ten codes were read as EAN-13, and each value matched the CSV number with its check digit added. This was a reading of an image, not of a printout with a scanner, so before using the labels, scan a test print as described below.
When it stops at “4.9E+11”, store the Excel column as text
If you enter 12- or 13-digit numbers in Excel as numbers, a cell left in the General format can display them in scientific notation, such as 4.9E+11. When you save that sheet as CSV, the file may contain 4.9E+11 exactly as displayed. In those rows the original number is gone.
When such a row exists, the tool stops before creating the PDF and tells you which row it is. The screen below shows a CSV whose fourth item was saved as 4.9E+11, after pressing Create and save PDF.
“CSV 5 (record)” counts from the top of the CSV file, including the column name row. The count does not change when you skip the first row, so look at row 5 in Excel.
To fix it, go back to the original Excel sheet rather than editing the scientific notation in the CSV. Select the EAN column, set its format to Text, re-enter the numbers and save again. You could also apply a number format such as 0 to show every digit, but numbers that start with 0 (common with UPC-A) lose the leading zero the moment Excel treats them as numbers. A product code is never used in calculations, so keeping it as text from the start is easier. The tool uses CSV values as text and keeps leading zeros.
Rows with a wrong check digit also stop with a row number
If you enter 13 digits, the tool checks whether the 13th digit is the correct check digit. A typo from manual entry, or a row where someone pasted another product’s number, is caught here. The screen below is the result for a CSV where the seventh item (Mini notebook A6) has the number 4900000000073, wrong only in its last digit. The correct number is 4900000000078.
If your list is kept in 13 digits, suspect the number itself in any row that triggers this error. A product carrying a barcode with the wrong number is read at the checkout as a different product, or as an item that is not registered. If you keep 12 digits and let the tool add the check digit, this error never appears, but there is also no way to tell whether the 12 digits themselves are right. You still need to compare them with your product master data separately.
Only the first error found is shown. After fixing it, press Create and save PDF again; if there is another mistake, its row is shown next.
How much the bar width changes with 3, 2 or 1 columns
Changing the number of columns in the layout changes the width available for each item, and the whole barcode is scaled to fit it. The width of one narrowest bar is called a module. For the EAN-13 symbol, the nominal size (1.0×) has a 0.33 mm module, and the permitted range is 0.8× to 2.0× (a module of 0.264–0.660 mm), according to GS1 Japan’s page on the JAN symbol (in Japanese; the values follow the GS1 specification for EAN-13).
From the tool’s implementation (A4 portrait, 10 mm outer margin, 4 mm gap between items, a quiet zone of 12 modules on each side of the barcode), the size of an EAN-13 barcode works out as follows.
| Print layout | Module | Approx. magnification | Width of the bars | Bar height (with / without caption) |
|---|---|---|---|---|
| 3 columns × 8 rows | about 0.48 mm | about 1.4× | about 45 mm | 16 mm / 22 mm |
| 2 columns × 8 rows | about 0.75 mm | about 2.3× | about 71 mm | 16 mm / 22 mm |
| 1 column × 6 rows | about 1.56 mm | about 4.7× | about 149 mm | 22 mm / 22 mm |
For EAN-13, only three columns stays within the 0.8–2.0× range. With two columns or one column the issue is not readability so much as exceeding the size defined for the EAN-13 symbol. If you only scan the sheet by hand during stocktaking, large codes rarely cause trouble, but for labels you stick on products, choose three columns. The tool warns when the narrowest bar is below 0.25 mm, which covers codes that are too small; nothing is shown when they are too large, so use this table as a guide.
The height column shows something else: at three columns the bars are short for their width. The nominal EAN-13 symbol measures 37.29 mm wide and 25.93 mm high including the quiet zones (GS1 Japan, “How to create a GTIN (JAN code)”, in Japanese), so scaling it to about 1.4× should make it taller in proportion, but this tool’s PDF caps the bar height at 22 mm. GS1 Japan presents cutting the bar height when print space is short, called truncation, as a method that still scans if the height shown in its figure is kept. It also notes that truncation is not defined in the Japanese Industrial Standard (JIS) and cannot be used on products for export (same page). For labels on products sold abroad, or for customers who give you print quality requirements, use a printing method that can produce the barcode at the specified size instead of this PDF.
Scan a test print before you stick the labels on
Once you have the PDF, first print one sheet on plain paper and scan several codes with the scanner you will actually use at the till or during stocktaking. Check that the 13 digits you read match the numbers in your product master, and that no caption has been paired with the wrong number. On barcode colours, GS1 Japan says black bars on a white background are best and that bars in red tones should be avoided because they cannot be read (How to create a GTIN (JAN code)). This tool’s PDF is black on white, but take care when printing on coloured paper or labels.
In the PDF, items sit in cells about 60.7 mm wide and 31.1 mm high, three across and eight down. Commercial label sheets differ in label size and margins from product to product and will not necessarily line up with these cells. If you want to print straight onto a label sheet, first print on plain paper, hold it over the label sheet against the light and check the positions. If they do not match, it is more reliable to print on plain paper or an uncut sticker sheet and cut the labels apart.
How to check codes with the camera on a phone or PC is explained in scanning barcodes with a phone or PC camera. You can save the scanned results and compare them side by side with the numbers in your CSV.
When to choose Code 128 or ITF-14 instead
An EAN-13 number identifies a product so that checkouts outside your shop can recognize it too. For numbers that contain letters or hyphens, such as internal stock codes or shelf numbers, choose Code 128 under Barcode format. If you set Barcode data column number to another column of the same CSV (your own item code, for example), you can keep the product name as the caption and change only the symbology. Code 128 barcodes get longer as the text gets longer, so a long code printed in three columns can become thin enough to trigger the 0.25 mm warning. In that case, reduce the number of columns.
The number on outer cases such as cardboard boxes uses ITF-14; as with EAN-13, entering 13 digits adds the check digit. To create a single barcode and save it as an image, use the barcode generator, which saves SVG or PNG. The steps are in creating a Code 128 barcode for shelf labels.
To print URLs or longer text from a list, CSV to QR Code PDF uses the same layout. How to decide the print size of a QR code is covered in QR code size for printing.