How to Make Gift Certificates from Google Sheets: Numbered PDFs, a Redemption Log and Remaining Balances (2026)

Gift certificates are an easy sale in December for a salon, café, studio, shop or anyone who sells a service. The hard part comes later: someone walks in with a certificate, and you need to know at once whether it’s real, how much is left on it and whether it has already been used. A stack of carbon copies or a notebook doesn’t answer that quickly, and a certificate with a number like 004 is easy to copy. This guide keeps every certificate in a Google Sheet with one row each, logs every use in a second tab so balances update on their own, flags the mistakes that cost money (a code typed wrong, a certificate used for more than it holds), and adds a free Apps Script that gives each certificate a code that can’t be guessed and turns the row into a printable PDF from your own Google Docs design.

It treats a certificate as money you owe: sold certificates are worth a dollar amount, even when they are for a service such as a massage. If you already sell gift cards through your point-of-sale system, its balances are the official ones; this setup is for businesses that sell certificates by hand.

Before you start: expiration dates

In the US, gift certificates have federal rules. Under Regulation E, 12 CFR 1005.20, a gift certificate or store gift card sold to a consumer for a set amount can’t be sold with an expiration date unless its funds stay good for at least five years after it was issued, and the expiration has to be disclosed on it. Fees for not using it are restricted too. Two exclusions matter for small sellers:

Many states go further, and some don’t allow expiration dates at all. The simplest choice is to leave Expires blank on everything you sell, which prints “No expiration date”. If you do use one, =EDATE(B2, 60) gives the date five years after the issue date in B, and the script below refuses a sold certificate that expires sooner. This is a summary, not legal advice; check your state’s rules.

Step 1: the Certificates tab

Make a tab named Certificates with one row per certificate. Type the headers below in row 1 exactly; the script finds columns by name, so you can add others (Paid by, Payment method, Sold by) anywhere. Columns M and N, Certificate and Made at, are filled in by the script.

A
Code
B
Issued on
C
Type
D
Value
E
Service
F
From
G
To
H
Send to
I
Expires
J
Used
K
Balance
L
Status
GC-1001-7KQ4Nov 2, 2026Amount50.00Dana RuizSam Ruizdana@…50.000.00Redeemed
GC-1002-M9TXNov 9, 2026Amount100.00Priya ShahLeo Shahleo@…35.0065.00Partly used
GC-1003-R2HWNov 14, 2026Service90.00One 60-minute massageTom BeckerAna Beckertom@…0.0090.00Active
GC-1004-D6PNOct 1, 2026Promotional20.00Loyalty rewardChris Wongchris@…Dec 15, 20260.0020.00Active
GC-1005-H8ZCSep 1, 2026Promotional15.00Grand openingMia Fordmia@…Oct 31, 20265.0010.00Expired

Example data, with the Status as it reads on November 22, 2026. Leave Code empty on new rows; the script fills it in.

Put these formulas in row 2 and fill them down. Used (J) adds up the redemptions for the row’s code:

=IF(A2="", "", SUMIFS(Redemptions!$C$2:$C, Redemptions!$B$2:$B, A2))

Balance (K) is the value minus what has been used, rounded to the cent so 100 − 35 shows 65.00 and never 64.999999:

=IF(A2="", "", ROUND(D2-J2, 2))

Status (L):

=IF(A2="", "", IF(K2<0, "Over-redeemed", IF(K2=0, "Redeemed", IF(AND(I2<>"", I2<TODAY()), "Expired", IF(J2>0, "Partly used", "Active")))))

The order matters: a balance below zero is shown first, because it means something was redeemed twice. A certificate that is fully used shows Redeemed even if its date has passed. An expired one with money left, like GC-1005 above, shows Expired; for promotional certificates that is the end of it, while for one you sold you would usually still honor it.

Step 2: the Redemptions tab

Make a second tab named Redemptions and add a row each time a certificate is used, including partial uses.

A
Date
B
Code
C
Amount
D
Note
E
Balance after
Oct 12, 2026GC-1005-H8ZC5.00Coffee10.00
Nov 10, 2026GC-1001-7KQ430.00Haircut20.00
Nov 18, 2026GC-1001-7KQ420.00Products0.00
Nov 20, 2026GC-1002-M9TX35.00Lunch for two65.00

Make column B a dropdown of real codes with Data › Data validation › Dropdown (from a range) and the range Certificates!A2:A, and choose Reject the input so a code that doesn’t exist can’t be typed in. Balance after (E) shows what was left after each use, which is the number you tell the customer:

=IF(B2="", "", ROUND(XLOOKUP(B2, Certificates!$A$2:$A, Certificates!$D$2:$D) - SUMIFS($C$2:C2, $B$2:B2, B2), 2))

It takes the certificate’s value with XLOOKUP and subtracts every use of that code from the top of the list down to this row, so keep the rows in date order. The code match ignores capitals, the same as SUMIFS on the Certificates tab.

Step 3: checks and what you owe

Select the data rows on Certificates (A2:N) and add these rules with Format › Conditional formatting › Custom formula is:

On Redemptions (A2:E), add two more. Conditional formatting can only look at another tab through INDIRECT, so the unknown-code rule is written like this, which catches codes pasted in past the dropdown:

In two spare cells on Certificates, to the right of the table, add what you still owe on certificates that haven’t expired and how many there are. In the example that is 175.00 on 3 certificates:

=SUMIFS(K2:K, K2:K, ">0", L2:L, "<>Expired")
=COUNTIFS(K2:K, ">0", L2:L, "<>Expired")

Your accountant may want that figure at year-end, because money taken for certificates that haven’t been used is usually still owed to customers rather than earned.

Step 4: design the certificate in Google Docs

Create a Google Doc with your design: logo, colors, a border, your terms (for example “Not redeemable for cash. Lost certificates can be replaced with proof of purchase.”) and how to book. Type these placeholders where the details go, with the double braces and the exact spelling:

For a certificate smaller than a page, set the paper size in File › Page setup; the PDF uses the Doc’s page size. Copy the Doc’s ID from its address (the part between /d/ and /edit), and make a Drive folder for the PDFs and copy its ID the same way.

Step 5: the script that makes the PDFs

  1. In the spreadsheet, open Extensions › Apps Script, delete what is there and paste the script below.
  2. Set TEMPLATE_ID, FOLDER_ID and BUSINESS_NAME. Leave PREVIEW = true for now.
  3. Save, reload the spreadsheet and choose Gift certificates › Make certificates for new rows. Approve the permissions the first time.
  4. Open the PDFs named PREVIEW in your folder and check the layout. Then delete them, set PREVIEW = false, save and run it again.
/**
 * Gift certificates from Google Sheets: one numbered PDF per row, made from a Google Docs template.
 *
 * Tab "Certificates" (row 1 = headers, extra columns are fine):
 *   Code | Issued on | Type | Value | Service | From | To | Send to | Expires | Used | Balance | Status |
 *   Certificate | Made at
 * Tab "Redemptions": Date | Code | Amount | Note | Balance after   (the script only reads Certificates)
 *
 * For every Certificates row without a Certificate link it gives the row a code if it has none
 * (GC-1001-7KQ4: a running number plus 4 random characters, so codes can't be guessed), fills the
 * template's {{placeholders}}, saves a PDF in your folder and writes the code, link and time back.
 * Run it with PREVIEW = true first: it makes up to 3 PDFs named "PREVIEW", writes nothing to the
 * sheet and emails (if EMAIL_CERTS is on) go only to you.
 */
const TEMPLATE_ID   = 'PASTE_TEMPLATE_DOC_ID';
const FOLDER_ID     = 'PASTE_OUTPUT_FOLDER_ID';
const BUSINESS_NAME = 'Your Business Name';
const PREFIX        = 'GC';      // codes look like GC-1001-7KQ4
const FIRST_NUMBER  = 1001;
const PREVIEW       = true;      // set to false for the real run
const EMAIL_CERTS   = false;     // true emails each PDF to the row's "Send to" address
const REPLY_TO      = '';        // optional reply-to address for those emails
const KEEP_DOCS     = false;     // true keeps the filled Google Doc next to each PDF
const MAX_PER_RUN   = 40;
const TYPES = { 'amount': 'Gift certificate', 'service': 'Gift certificate', 'promotional': 'Promotional certificate' };
const SAFE = 'ABCDEFGHJKMNPQRSTUVWXYZ23456789';   // no 0/O, 1/I/L, so codes read back easily

function onOpen() {
  SpreadsheetApp.getUi().createMenu('Gift certificates')
    .addItem('Make certificates for new rows', 'makeGiftCertificates')
    .addToUi();
}

function makeGiftCertificates(now) {
  now = now || new Date();
  const lock = LockService.getDocumentLock();
  if (!lock.tryLock(30000)) return;                     // another run is busy; try again in a minute
  try {
    const started = Date.now();
    const ss = SpreadsheetApp.getActive();
    const tz = ss.getSpreadsheetTimeZone();
    const fmt = (d) => Utilities.formatDate(d, tz, 'MMMM d, yyyy');
    const sh = ss.getSheetByName('Certificates');
    if (!sh) throw new Error('No tab named "Certificates".');
    const data = sh.getDataRange().getValues();
    const head = data[0].map((h) => String(h).trim().toLowerCase());
    const need = ['Code', 'Issued on', 'Type', 'Value', 'Service', 'From', 'To', 'Send to', 'Expires', 'Certificate', 'Made at'];
    const missing = need.filter((n) => head.indexOf(n.toLowerCase()) < 0);
    if (missing.length) throw new Error('Missing column(s) on Certificates: ' + missing.join(', '));
    const c = {};
    need.forEach((n) => { c[n] = head.indexOf(n.toLowerCase()); });

    const props = PropertiesService.getDocumentProperties();
    const key = 'lastGiftNumber-' + PREFIX;
    const codes = {};
    let last = Math.max(Number(props.getProperty(key) || 0), FIRST_NUMBER - 1);
    const numRe = new RegExp('^' + PREFIX + '-(\\d+)-', 'i');
    for (let r = 1; r < data.length; r++) {
      const code = String(data[r][c['Code']]).trim().toUpperCase();
      if (!code) continue;
      codes[code] = (codes[code] || 0) + 1;
      const m = code.match(numRe);
      if (m) last = Math.max(last, Number(m[1]));
    }

    const folder = DriveApp.getFolderById(FOLDER_ID);
    const template = DriveApp.getFileById(TEMPLATE_ID);
    const me = Session.getEffectiveUser().getEmail();
    const problems = [], noEmail = [];
    let made = 0, emailed = 0, stopped = '';

    for (let r = 1; r < data.length; r++) {
      const row = data[r];
      if (String(row[c['Certificate']]).trim() !== '') continue;            // already made
      const to = String(row[c['To']]).trim();
      const typeRaw = String(row[c['Type']]).trim();
      if (!to && !typeRaw) continue;                                         // empty row
      const why = checkRow_(row, c);
      let code = String(row[c['Code']]).trim().toUpperCase();
      if (!why && code && codes[code] > 1) problems.push((r + 1) + ' (code used twice)');
      if (why) { problems.push((r + 1) + ' (' + why + ')'); continue; }
      if (code && codes[code] > 1) continue;
      if (made >= (PREVIEW ? 3 : MAX_PER_RUN)) { stopped = 'limit'; break; }
      if (Date.now() - started > 270000) { stopped = 'time'; break; }      // stay inside the 6-minute limit
      const addr = String(row[c['Send to']]).trim();
      const canEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(addr);
      if (EMAIL_CERTS && canEmail && MailApp.getRemainingDailyQuota() < 1) { stopped = 'quota'; break; }  // checked before the PDF exists
      if (PREVIEW) {
        code = code || PREFIX + '-PREVIEW';
      } else if (!code) {
        code = newCode_(++last, codes);
        props.setProperty(key, String(last));                               // reserve the number first
        codes[code] = 1;
        sh.getRange(r + 1, c['Code'] + 1).setValue(code);                    // saved before any file exists
      }
      const type = typeRaw.toLowerCase();
      const value = money_(Math.round(Number(row[c['Value']]) * 100));
      const service = String(row[c['Service']]).trim();
      const exp = row[c['Expires']];
      const fields = {
        'Title': TYPES[type],
        'Business': BUSINESS_NAME,
        'Code': code,
        'To': to,
        'From': String(row[c['From']]).trim(),
        'Value': value,
        'Good for': service ? service + ' (value ' + value + ')' : (type === 'promotional' ? 'Promotional value toward any purchase' : 'Any purchase'),
        'Issued on': fmt(row[c['Issued on']]),
        'Expires': exp instanceof Date ? fmt(exp) : 'No expiration date'
      };
      const name = (PREVIEW ? 'PREVIEW ' : '') + code + ' ' + to;
      const copy = template.makeCopy(name, folder);
      const doc = DocumentApp.openById(copy.getId());
      const body = doc.getBody();
      Object.keys(fields).forEach((k) => replaceTag_(body, '{{' + k + '}}', String(fields[k])));
      doc.saveAndClose();
      const pdf = folder.createFile(copy.getAs(MimeType.PDF).setName(name + '.pdf'));
      if (!KEEP_DOCS) copy.setTrashed(true);
      if (!PREVIEW) {
        sh.getRange(r + 1, c['Certificate'] + 1).setValue(pdf.getUrl());
        sh.getRange(r + 1, c['Made at'] + 1).setValue(now);
      }
      made++;

      if (EMAIL_CERTS) {
        if (!canEmail) { noEmail.push(r + 1); continue; }
        const msg = {
          to: PREVIEW ? me : addr,
          subject: (PREVIEW ? '[PREVIEW to ' + addr + '] ' : '') + 'Your ' + TYPES[type].toLowerCase() + ' from ' + BUSINESS_NAME,
          body: 'Hi,\n\nYour ' + TYPES[type].toLowerCase() + ' for ' + to + ' is attached. ' +
                'The code on it is what you redeem, so keep this email.\n\n' + BUSINESS_NAME,
          name: BUSINESS_NAME,
          attachments: [pdf.getAs(MimeType.PDF)]
        };
        if (REPLY_TO) msg.replyTo = REPLY_TO;
        MailApp.sendEmail(msg);
        emailed++;
      }
    }
    const note = 'Made ' + made + ' certificate(s)' + (PREVIEW ? ' in PREVIEW (nothing written to the sheet)' : '') +
      (EMAIL_CERTS ? ', emailed ' + emailed : '') + '.' +
      (problems.length ? ' Check rows ' + problems.join(', ') + '.' : '') +
      (noEmail.length ? ' No valid Send to on rows ' + noEmail.join(', ') + '.' : '') +
      (stopped ? ' Stopped early (' + stopped + '); run it again for the rest.' : '');
    ss.toast(note, 'Gift certificates', 10);
    return { made: made, emailed: emailed, problems: problems, noEmail: noEmail, stopped: stopped };
  } finally {
    lock.releaseLock();
  }
}

/** Returns why a row can't be made yet, or '' when it is fine. */
function checkRow_(row, c) {
  const type = String(row[c['Type']]).trim().toLowerCase();
  const issued = row[c['Issued on']], exp = row[c['Expires']], value = row[c['Value']];
  if (!TYPES[type]) return 'Type must be Amount, Service or Promotional';
  if (!String(row[c['To']]).trim()) return 'no To name';
  if (!(issued instanceof Date)) return 'Issued on is not a date';
  if (typeof value !== 'number' || !(value > 0)) return 'Value is not a number above 0';
  if (type === 'service' && !String(row[c['Service']]).trim()) return 'Service is empty';
  if (exp !== '' && exp !== null && !(exp instanceof Date)) return 'Expires is not a date';
  if (exp instanceof Date && exp < issued) return 'expires before it was issued';
  if (exp instanceof Date && type !== 'promotional' && exp < addMonths_(issued, 60)) return 'a sold certificate expires within 5 years';
  return '';
}

/** GC-1001-7KQ4: running number plus 4 random characters, never a code that already exists. */
function newCode_(n, codes) {
  for (;;) {
    const hex = Utilities.getUuid().replace(/-/g, '');
    let s = '';
    for (let i = 0; i < 4; i++) s += SAFE.charAt(parseInt(hex.substr(i * 2, 2), 16) % SAFE.length);
    const code = PREFIX + '-' + n + '-' + s;
    if (!codes[code]) return code;
  }
}

// Literal find-and-replace, so values containing $ or \ are inserted exactly.
function replaceTag_(part, tag, value) {
  const pattern = tag.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  for (let n = 0, found = part.findText(pattern); found && n < 500; n++, found = part.findText(pattern)) {
    const text  = found.getElement().asText();
    const start = found.getStartOffset();
    text.deleteText(start, found.getEndOffsetInclusive());
    if (value !== '') text.insertText(start, value);
  }
}

/** Cents -> "$1,234.50". */
function money_(cents) {
  const neg = cents < 0, a = Math.abs(cents);
  const d = String(Math.floor(a / 100)).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
  return (neg ? '-' : '') + '$' + d + '.' + String(a % 100).padStart(2, '0');
}

/** Same as EDATE in Sheets: add months, clamping to the end of a shorter month. */
function addMonths_(d, months) {
  const out = new Date(d.getFullYear(), d.getMonth() + months, 1);
  const lastDay = new Date(out.getFullYear(), out.getMonth() + 1, 0).getDate();
  out.setDate(Math.min(d.getDate(), lastDay));
  return out;
}

What the script does

Step 6: sending the certificates

To email them, set EMAIL_CERTS = true. Each new certificate’s PDF goes to the row’s Send to address, which can be the buyer (who prints it for the card) or the recipient, from your account with BUSINESS_NAME as the sender name; replies go to REPLY_TO if you set one. With PREVIEW = true every email comes only to you, with the real address in the subject. Rows without a valid Send to still get a PDF and are listed in the summary. Before each certificate the script checks your remaining daily Apps Script email quota (100 recipients a day on a consumer Gmail account, 1,500 on Google Workspace) and stops while it can still email it, so no certificate is left made but not sent; the next run carries on.

To print instead, open the PDF and print it on card stock. Write the code on nothing else: the certificate and the sheet are the only places it should appear.

At the counter

When a certificate comes in, find its code on the Certificates tab (Data › Create a filter on column A makes this quick on a phone), check the Status and Balance, then add the redemption row. Balance after tells you what to say: “You have $20.00 left.” If Status says Over-redeemed, Expired or the code isn’t there, stop and look before you accept it.

Pitfalls

FAQ

Can Google Sheets make gift certificates?

Yes. Keep one row per certificate on a Certificates tab with the code, issue date, type, value, who it is from and to, and an optional expiration date. Design the certificate once in Google Docs with placeholders such as {{Code}} and {{Value}}, and a short Apps Script fills a copy for each new row and saves it as a PDF in a Drive folder. The script on this page also gives each certificate its code and can email the PDF.

How do I track gift certificate balances in Google Sheets?

Log every use on a Redemptions tab (date, code, amount). On the Certificates tab, Used is =IF(A2="", "", SUMIFS(Redemptions!$C$2:$C, Redemptions!$B$2:$B, A2)) and Balance is =IF(A2="", "", ROUND(D2-J2, 2)), where D is the value. A Status formula then shows Active, Partly used, Redeemed, Expired or Over-redeemed, and =SUMIFS(K2:K, K2:K, ">0", L2:L, "<>Expired") totals what you still owe.

How do I make unique gift certificate codes in Google Sheets?

Don’t use a formula. RANDBETWEEN and RAND are volatile, so Sheets recalculates them and a formula-made code can change after you have handed out the certificate. The script on this page writes each code as a fixed value: a running number plus four random characters, such as GC-1002-M9TX, skipping look-alike characters like 0/O and 1/I. A conditional formatting rule with =AND($A2<>"", COUNTIF($A$2:$A, $A2)>1) highlights any code typed twice.

Do gift certificates have to be valid for five years?

In the US, federal rules (Regulation E, 12 CFR 1005.20) say a gift certificate or store gift card sold to a consumer can’t have funds that expire less than five years after it was issued, and the expiration has to be disclosed on it. Certificates issued only on paper, and loyalty, award or promotional certificates, are excluded from that rule, but a promotional one has to say it is promotional and show its expiration date on the front. A certificate emailed as a PDF or code is not paper-only. Many states have stricter rules, so check yours; the simplest choice is no expiration date.

Can I email gift certificates from Google Sheets?

Yes. In the script on this page set EMAIL_CERTS = true and each new certificate’s PDF is emailed to the row’s Send to address, which can be the buyer or the recipient. Run it with PREVIEW = true first: preview emails go only to you, with the real address in the subject. Apps Script’s daily email quota is 100 recipients on a consumer Gmail account and 1,500 on Google Workspace.

How do I void or refund a gift certificate in the sheet?

Don’t delete the row: the code would become free for a typo to match and you lose the record. Add a redemption for the remaining balance with a note such as “Void, refunded” or “Replaced by GC-1007-…”. The balance goes to zero, the status changes to Redeemed and the history stays in the Redemptions tab.

Want documents without maintaining a script? SheetWeave (disclosure: we make it) is a Google Sheets add-on that fills a Google Docs template from each row and saves a Doc, a PDF, or both in a Drive folder you choose, writing the links back to the row. It can run on selected rows, all rows, or only new ones. Sheet data stays inside your Google account and it uses narrow scopes. 14-day free trial, no credit card required.
See SheetWeave

Related Google Sheets guides

Instructions refer to Google Sheets, Google Docs, Google Drive and Apps Script as they worked on November 22, 2026, and to 12 CFR 1005.20 as published by the Consumer Financial Protection Bureau that day. Not legal, tax or accounting advice, and not affiliated with Google or the CFPB. Google Sheets, Google Docs and Google Drive are trademarks of Google LLC. Check your state’s gift certificate rules before you set expiration dates or fees. Questions or corrections: hello@loomwise.app.