Skip to content
Digital Inspiration DocsDigital Inspiration Docs

Document Studio can put a different barcode in every email and document it creates. Use a barcode for anything a scanner reads at a counter: gift cards, membership numbers, vouchers, parcel labels or library cards. The number comes from your Google Sheet or form response.

You can add the barcode in two ways. An Embed Barcode marker in your template needs no extra column. A BARCODE formula in your sheet lets you see every barcode before the workflow runs.

Maya Chen sells gift cards for her workshops at Willow Lane Studio. Her front desk has a barcode scanner, so each gift card number should arrive as a barcode that staff can scan from the customer’s phone.

First Name Email Address Gift Card Value
Daniel daniel.okafor@example.net WL-2048-1175 $50
Hannah hannah.weber@example.org WL-2048-1176 $75
  1. Open the workflow and add a Send Email task, or open the one you have.

  2. In Email Body, type an Embed Barcode marker on a line of its own, where the barcode should appear.

    Hi {{First Name}},
    Here's your {{Value}} gift card for any workshop at Willow Lane Studio.
    Show this barcode at the front desk:
    {{Embed Barcode, {{Gift Card}}, format=Code 128}}
    Maya
  3. Click Preview. Document Studio sends the email to your own address with sample data. Scan the barcode with the scanner you’ll use at the desk.

  4. Click Done, then save the workflow.

Daniel’s email shows the barcode for WL-2048-1175, with the number printed below the bars in case the scanner is busy. If you leave out format=, the barcode is Code 128.

Daniel’s gift card email in Gmail, with a Code 128 barcode for WL-2048-1175 and the number printed below the bars

Document Studio attaches the barcode inside the email, so it shows even in email apps that hide pictures from the web.

The same marker works in a Google Docs, Slides or Sheets template. Maya can make a printable gift card in Google Docs with the same barcode as the email.

Template Where to type the marker What happens
Google Docs On a line of its own The barcode replaces the marker
Google Slides Alone in a text box The barcode replaces the whole text box and fits inside it
Google Sheets Alone in a cell The barcode sits over the cell. Spaces or a line break around the marker are fine, but no other text.

In Google Docs and Sheets, Document Studio shrinks a barcode wider or taller than 600 pixels to fit. A PDF made from the document includes the barcode.

Google Slides template with an Embed BARCODE marker for an EAN-13 book number with colors, and the presentation Document Studio created with a red and yellow barcode in its place
In Google Slides, the barcode takes the place of the text box that holds the marker.

You can write the value after Embed Barcode, in three ways:

You write The barcode holds If the title is misspelled
{{Embed Barcode, {{Gift Card}}}} The Gift Card cell of that row No barcode
{{Embed Barcode, Gift Card}} The Gift Card cell of that row A barcode of the misspelled title
{{Embed Barcode, "WL-2048, Studio"}} The text in quotes, exactly as typed

Use braces for a column of your sheet or a question of your form. Use quotes for text you type, and always for text with a comma, because a comma starts the options. Markers inside quotes are filled in for each row, like "{{First Name}}, seat {{Seat}}". When the cell is empty, Document Studio adds no barcode.

Use Marker
A gift card or voucher number {{Embed Barcode, {{Gift Card}}, format=Code 128}}
A book number from a form question {{Embed Barcode, {{Enter Book ISBN}}, format=EAN-13}}
A parcel label, short and without the number below {{Embed Barcode, {{Order Number}}, height=10, includetext=false}}
A format that is different for each row {{Embed Barcode, {{Code}}, format={{Barcode Type}}}}

Pick the format your scanner or system expects. If only your own staff scan the number, use Code 128. Code 128 takes letters, digits and symbols, and almost every scanner reads it.

Format Write it as What it holds Common use
Code 128 format=Code 128 Letters, digits and symbols Gift cards, order numbers, tickets
Code 39 format=Code 39 Capital letters, digits and a few symbols Name badges, inventory tags
EAN-13 format=EAN-13 12 or 13 digits Products sold in shops, books
UPC-A format=UPC-A 11 or 12 digits Products sold in the US and Canada
ISBN format=ISBN A book number with hyphens, like 978-1-78633-089-5 Books
Data Matrix format=Data Matrix Letters, digits and symbols, in a small square Parts, lab samples, small labels

Capital letters, spaces and hyphens in the format name don’t matter, so format=code128 and format=Code 128 are the same. For a book number without hyphens, use EAN-13.

Document Studio knows more than 100 formats, including postal and pharmacy codes. See the full list of formats.

Data Matrix packs the same text into a small square. Add scale=6 to make it twice as big. For a code that every phone camera opens, use a QR code.

Write options after the text, with a comma before each one:

{{Embed Barcode, {{Gift Card}}, format=Code 128, height=10, barcolor=#1A3C6E}}
Option What it does If you leave it out
format The barcode format Code 128
height Height of the bars in millimeters 20
scale Size of the whole picture. 6 is twice as big. 3
includetext Prints the text below the bars. Use includetext=false to hide it. Shown
rotate R turns the barcode right, L left and I upside down Not turned
barcolor Color of the bars, as a hex code Black
textcolor Color of the printed text, as a hex code Black
backgroundcolor Color behind the bars, as a hex code See-through

Scanners need strong contrast, so keep the bars dark. Add backgroundcolor=#FFFFFF if your readers use dark mode. Pictures are limited to 2000 by 2000 pixels. See the full list of options.

Document Studio adds a BARCODE function to Google Sheets. The formula turns each row’s number into a link to a picture of the barcode.

  1. Add a column titled Barcode to your sheet.

  2. Click the first cell under the title and paste this formula. C2 is the cell with the gift card number.

    =BARCODE(C2, "Code 128")
    Output
    https://charts.digitalinspiration.com/barcode/3TnLwPmD0RF0aPWf1LJCyfp1kgG1me2UoPWL4.png

    The cell shows a long link that ends in .png. That link is the picture of the barcode.

  3. Copy the formula to the other rows. Click the cell, then drag the small blue square at its bottom-right corner down to the last row.

  4. To see the barcodes in the sheet, add a column titled Barcode Preview. Enter =IMAGE(E2), where E2 is the cell with the link, and copy the formula down.

  5. In your template, type {{Barcode}} where the barcode should go.

The formula needs the format. Options go in a third value, in quotes, with a space between them, like =BARCODE(C2, "Code 128", "height=10 includetext=false").

Use the column with the link in your template, not the preview column. Document Studio shows a {{Barcode}} marker as the picture in emails, Google Docs, Slides and Sheets. In an email, the picture loads from charts.digitalinspiration.com when the reader opens the email.

  • Without format=, barcodes are Code 128. Older versions of Document Studio made Code 39.
  • Older email templates may have =BARCODE({{Gift Card}} format=Code128) typed in the Email Body. This still works in emails only. Use an Embed Barcode marker in new templates.
  • A barcode on a phone screen scans best at full brightness. Tell customers to turn the brightness up, or to print the email.
  • Give every row a different number. If a formula like RANDBETWEEN makes your numbers, the numbers change each time the sheet recalculates. Copy them and paste them as values before the workflow runs.
  • Document Studio removes the marker from the email Subject and from text messages, such as SMS and Google Chat.
  • A marker inside an {% if %} condition adds the barcode only when the condition is true.

The barcode is blank, or missing from the email

Section titled “The barcode is blank, or missing from the email”

The value doesn’t fit the format. EAN-13 and UPC-A take digits only, and the last digit must be the right check digit. Code 39 doesn’t take small letters, and Codabar needs a letter from A to D at each end. Fix the value, or switch to Code 128. Also check that the cell isn’t empty for that row.

The marker has no braces around the column title, like {{Embed Barcode, Gift Card}}, and no column has that title. Write {{Embed Barcode, {{Gift Card}}}} and check the spelling.

The text has a comma, so Document Studio read the rest as options. Put the text in quotes, like {{Embed Barcode, "WL-2048, Studio"}}.

The barcode is Code 128, not the format you asked for

Section titled “The barcode is Code 128, not the format you asked for”

Document Studio doesn’t know the format name, so it drew Code 128, the same as when you leave format= out. Check the spelling against the list of formats.

The BARCODE formula needs both the number and the format. Check that the cell the formula points to has a value, and that the format name is in the format table.

Google Sheets doesn’t know the BARCODE formula yet. Open the Extensions menu and choose Document Studio > Open once in this spreadsheet, then close the sidebar. The formula works after that.