
Barcode GenerationBarcode Generation
Keep Leading Zeros in Excel and CSV Barcode Data
Preserve barcode identifiers as text in Excel, check what your CSV actually contains, and prevent leading zeros from disappearing on import.
Use Word for Windows and an Excel list to set up barcode labels, preview records, and check each scan against its source value.

In Word for Windows, you can connect an Excel list to a label mail merge and use a barcode field to represent each record. Set up the label sheet, insert a field for the required barcode type, update the labels, and preview the records before printing. Then scan the printed labels and compare their values with the source list. Microsoft’s instructions apply to Word for Windows; Mac and web steps may differ. [1]
A fixed barcode and a batch of different barcodes are different jobs. Word’s DisplayBarcode field can display a fixed value; MergeBarcode takes a data field from a mail merge. Microsoft also illustrates a nested DisplayBarcode example that combines several merge fields. [1][2]
Choose a barcode type that your scanner and receiving workflow accept, and check its data requirements before merging. A Word field, a barcode font, and an add-in are different methods: do not assume that a font accepts raw data for every barcode type or that a label that looks correct will scan correctly.
Create a header row and one record per label. For an internal illustration, the following two values are distinct identifiers, not assigned retail product numbers:
| BarcodeValue | Description |
|---|---|
| 00123 | First item |
| AB-12 | Second item |
Store identifiers as text before entering or importing them, particularly when they have leading zeros. Compare the full values with your trusted source; changing a number to text after conversion does not restore missing zeros. [3] Make sure the chosen barcode type accepts the values you intend to use. Save and close the source file before connecting it if your version prompts you to do so.
For a single data column, Word documents the syntax MergeBarcode field-name barcode-type. With the example header above and Code 128 as the selected type, the field content would be:
MERGEBARCODE BarcodeValue CODE128
In the first label, press Ctrl+F9 to create Word’s field braces, then type the field content inside them. Typing ordinary braces yourself does not create a field. The header must match the source column. Use Word’s field-code view and update controls as needed to inspect the field; see Microsoft’s field reference for options and type-specific switches. [2]
This is a field-syntax example, not a tested output. It does not establish that either sample is acceptable for a particular business system or that your printer and scanner can read the resulting symbol.
Add a normal merge field for the readable identifier or description if useful. Select Mailings > Update Labels to copy the layout to the other labels, then Preview Results. Check the first, second, and later records: each barcode and its adjacent text should correspond to the same source row. [1]
Use Word’s mail-merge controls to finish the merge, then inspect the merged labels before printing. Print a small trial on the intended stock and printer. Scan each trial label with the intended reader and compare the complete decoded data against the matching source record, including any leading zeros. Check label alignment and leave enough clear space around each symbol for the application and scanner you use. Follow the receiving organization’s specific requirements.
If the values repeat, review the recipient list and label merge setup, then preview multiple records again. If zeros are missing, compare the original file, the Excel cell, the merged text, and the scan to find the first point of change. If a symbol looks present but will not scan, check its barcode type, input, print quality, size, and surrounding space against the requirements for your setup. A successful scan alone does not establish that a retailer or other recipient will accept the label.
[1] Microsoft Support. Add barcodes to labels. https://support.microsoft.com/en-us/word/add-barcodes-to-labels
[2] Microsoft Support. Field codes: MergeBarcode. https://support.microsoft.com/en-us/word/field-codes-mergebarcode
[3] Microsoft Support. Keeping leading zeros and large numbers. https://support.microsoft.com/en-us/excel/keeping-leading-zeros-and-large-numbers