How to Make Work Orders from Google Sheets (Printable PDF for Each Job, 2026)

Plenty of small service teams already keep their jobs in a spreadsheet: HVAC and plumbing outfits, property managers, facilities and maintenance teams, IT support, cleaning crews. The part that's still manual is the paper: someone copies last week's work order, retypes the customer, address and problem, and hopes the gate code from the previous job didn't slip through. This guide turns each job row into its own work order instead. You keep one Google Docs template with {{placeholders}}, list parts and materials on a second tab, tick a box, and a free Apps Script makes a Google Doc and a PDF for the technician, gives the job a work order number that never changes, adds a parts table with totals, and writes the links back to the row. Rows that are already done are skipped, so running it twice is safe.

Step 1: one row per job

Create a tab named Jobs. Each row is one work order. The script needs these headers in row 1 (any order): WO #, Customer, Generate, Doc status, Doc link, PDF link. Add whatever your work order should show, for example Site address, Contact phone, Problem, Priority, Technician, Scheduled and Estimate, plus a Job status column for your own tracking.

WO #CustomerSite addressProblemPriorityTechnicianScheduledEstimateJob statusGenerateDoc statusDoc linkPDF link
Harbor Dental40 Bay St, Unit 2No heat in back officeHighTech A12/3/2026450Scheduled☑
WO-1007Elm Street Cafe5 Elm StWalk-in cooler alarmUrgentTech B12/3/20261250.50Scheduled☑
Lakeside Library1 Shore DrQuote: replace lobby fixturesLowNew☐

Step 2: work order numbers that stay put

A work order number gets written on invoices, warranty claims and text messages, so it has to stay with its job forever. Avoid =ROW()-style formulas: they change when rows are sorted or deleted. Leave WO # blank and let the script assign the next number (WO-1001, WO-1002…) as a plain value. It looks at the highest number already in the column, so typed or imported numbers like WO-1007 are respected and never reused.

Numbers are assigned when a row is generated, or earlier with Work orders › Number new rows, which numbers every row that has a Customer but no WO # without creating any files. Use that when you want to list parts for a job (next step) before you print it.

Step 3: parts and materials on their own tab (optional)

A job can need one part or twelve, and squeezing them into columns like Part 1, Part 2, Part 3 falls apart fast. Put them on a second tab named Parts instead, one row per line, with the work order number in the first column:

WO #ItemQtyUnit price
WO-1007Door gasket238.50
WO-1007Labor (hours)1.595
WO-1007Shop supplies

The script collects every line for a work order and puts them in a table on the document (Item, Qty, Unit price, Amount, plus a Total row). A blank Qty counts as 1, and a blank Unit price shows the line without an amount, which is handy for a technician's checklist of what to bring. A Qty or price that isn't a number stops just that work order with an error in Doc status, so a typo never prints a wrong total. If you don't need parts at all, skip the tab; the script works without it.

To see each job's parts total back on the Jobs tab, add a Parts total column with =SUMPRODUCT((Parts!A$2:A=A2)*IF(Parts!C$2:C="",1,Parts!C$2:C)*Parts!D$2:D), or the simpler =SUMIF(Parts!A:A,A2,Parts!E:E) if you add an Amount column (=C2*D2) to the Parts tab.

Step 4: the Google Docs template

Create a Google Doc laid out the way your technicians like it, and put a placeholder wherever a row value goes. A placeholder is the column header in double curly braces, spelled exactly like row 1: {{Customer}}, {{Site address}}, {{WO #}}. They work in the body, header and footer. Two placeholders come from the Parts tab: put {{Parts table}} on a line by itself where the table should go, and {{Parts total}} anywhere.

WORK ORDER  {{WO #}}                         Priority: {{Priority}}

Customer: {{Customer}}            Phone: {{Contact phone}}
Site: {{Site address}}
Scheduled: {{Scheduled}}          Technician: {{Technician}}

Problem reported
{{Problem}}

Parts and materials
{{Parts table}}
Parts total: {{Parts total}}      Estimate: {{Estimate}}

Work performed: ______________________________________________
Time in: ________  Time out: ________  Follow-up needed?  Y / N
Customer signature: ____________________  Date: __________

The lines at the bottom stay blank on purpose: the PDF is printed or opened on a phone, and the technician fills them in on site. Copy the template's ID from its URL (between /d/ and /edit), and the ID of the Drive folder for finished work orders (after /folders/).

Step 5: the script

In the sheet, open Extensions › Apps Script, replace the sample code with the script below, paste your two IDs into TEMPLATE_ID and FOLDER_ID, and save. Reload the sheet: a Work orders menu appears. Choose Generate ticked rows and approve the permissions the first time.

/**
 * Work orders from a Google Sheets job list and a Google Docs template.
 * "Jobs" tab headers used (any order): Customer, WO #, Generate, Doc status,
 * Doc link, PDF link. Every other column (Site address, Problem, Priority,
 * Technician, Scheduled...) can be used in the template as {{Header}}.
 * Optional "Parts" tab, one row per part or material line:
 * WO #, Item, Qty, Unit price. Put {{Parts table}} on its own line in the
 * template where the table should go, and {{Parts total}} anywhere.
 * Only rows with Generate ticked and an empty PDF link are processed.
 */
const SHEET_NAME       = 'Jobs';
const PARTS_SHEET      = 'Parts';            // optional tab; skipped if it doesn't exist
const TEMPLATE_ID      = 'PASTE_TEMPLATE_DOC_ID';
const FOLDER_ID        = 'PASTE_DRIVE_FOLDER_ID';
const DATE_FORMAT      = 'MMM d, yyyy';      // how date cells appear on the work order
const CURRENCY_COLUMNS = ['Estimate'];       // numbers in these Jobs columns become $1,250.00
const CURRENCY_SYMBOL  = '$';
const NUMBER_PREFIX    = 'WO-';              // new work order numbers: WO-1001, WO-1002...
const FIRST_NUMBER     = 1001;
const MAX_PER_RUN      = 25;                 // stop early; run again for the rest
const MAX_RUNTIME_MS   = 4.5 * 60 * 1000;    // Apps Script stops runs at 6 minutes

function onOpen() {
  SpreadsheetApp.getUi().createMenu('Work orders')
    .addItem('Number new rows', 'numberWorkOrders')
    .addItem('Generate ticked rows', 'generateWorkOrders').addToUi();
}

// Gives every row that has a Customer but no WO # the next number, as a plain value.
function numberWorkOrders() {
  const j = readJobs_();
  let n = 0;
  for (let i = 1; i < j.rows.length; i++) {
    const r = j.rows[i];
    if (String(r[j.c.customer]).trim() === '' || String(r[j.c.num]).trim() !== '') continue;
    j.put(i, 'num', j.next()); n++;
  }
  j.ss.toast(n + ' work order number(s) assigned.');
  return n;
}

function generateWorkOrders() {
  const started = Date.now();
  const j = readJobs_();
  const rows = j.rows, c = j.c, put = j.put;
  const tz       = Session.getScriptTimeZone();
  const parts    = readParts_(j.ss);
  const template = DriveApp.getFileById(TEMPLATE_ID);
  const folder   = DriveApp.getFolderById(FOLDER_ID);

  let made = 0, stopped = false;
  for (let i = 1; i < rows.length; i++) {
    const r = rows[i];
    if (r[c.gen] !== true || r[c.pdf] !== '' || String(r[c.customer]).trim() === '') continue;
    if (made >= MAX_PER_RUN || Date.now() - started > MAX_RUNTIME_MS) { stopped = true; break; }
    try {
      if (String(r[c.num]).trim() === '') put(i, 'num', j.next());
      const num   = String(r[c.num]).trim();
      const lines = parts[num] || [];
      const bad   = lines.filter((l) => isNaN(l.qty) || isNaN(l.amount));
      if (bad.length) throw new Error('Parts line "' + bad[0].item + '" has a Qty or Unit price that is not a number');
      const fileName = num + ' - ' + r[c.customer];

      // Reuse a Doc left by an earlier run (link in the row, or same name in the folder).
      let docFile = null;
      const id = String(r[c.doc]).match(/\/d\/([\w-]+)/);
      if (id) docFile = DriveApp.getFileById(id[1]);
      if (!docFile) docFile = findInFolder_(folder, fileName, MimeType.GOOGLE_DOCS);
      if (!docFile) docFile = template.makeCopy(fileName, folder);
      if (!id) put(i, 'doc', docFile.getUrl());

      const values = {};
      j.head.forEach((h, k) => { if (h) values[h] = formatValue_(h, r[k], tz); });
      const total = lines.reduce((s, l) => s + l.amount, 0);
      values['Parts total'] = lines.length ? money_(total) : '';

      const doc = DocumentApp.openById(docFile.getId());
      insertPartsTable_(doc.getBody(), lines, total);
      for (const part of [doc.getBody(), doc.getHeader(), doc.getFooter()]) {
        if (!part) continue;
        for (const h of Object.keys(values)) replaceTag_(part, '{{' + h + '}}', values[h]);
      }
      const left = doc.getBody().getText().match(/\{\{[^{}]+\}\}/g) || [];
      doc.saveAndClose();

      let pdf = findInFolder_(folder, fileName + '.pdf', MimeType.PDF);
      if (!pdf) pdf = folder.createFile(docFile.getAs(MimeType.PDF)).setName(fileName + '.pdf');
      put(i, 'pdf', pdf.getUrl());
      put(i, 'status', 'Generated ' + Utilities.formatDate(new Date(), tz, 'yyyy-MM-dd') +
        (left.length ? ' (no column for ' + left.filter((t, k) => left.indexOf(t) === k).join(', ') + ')' : ''));
      made++;
    } catch (e) {
      put(i, 'status', 'Error: ' + e.message);
      if (/too many times|quota|limit exceeded/i.test(e.message)) { stopped = true; break; }
    }
  }
  j.ss.toast(made + ' work order(s) generated.' + (stopped ? ' Run again to continue.' : ''));
  return made;
}

function readJobs_() {
  const ss   = SpreadsheetApp.getActive();
  const sh   = ss.getSheetByName(SHEET_NAME);
  const rows = sh.getDataRange().getValues();
  const head = rows[0].map((h) => String(h).trim());
  const col  = (name) => head.indexOf(name);
  const c = {
    customer: col('Customer'), num: col('WO #'), gen: col('Generate'),
    status: col('Doc status'), doc: col('Doc link'), pdf: col('PDF link'),
  };
  for (const k of Object.keys(c)) {
    if (c[k] === -1) throw new Error('Missing column for ' + k + '. Check the headers in row 1.');
  }
  // Highest number already used, so new numbers never repeat.
  let last = FIRST_NUMBER - 1;
  for (const r of rows.slice(1)) {
    const m = String(r[c.num]).match(/(\d+)\s*$/);
    if (String(r[c.num]).indexOf(NUMBER_PREFIX) === 0 && m) last = Math.max(last, Number(m[1]));
  }
  return {
    ss, rows, head, c,
    put: (i, k, v) => { rows[i][c[k]] = v; sh.getRange(i + 1, c[k] + 1).setValue(v); },
    next: () => NUMBER_PREFIX + (++last),
  };
}

// Parts tab lines grouped by WO #. A blank Qty counts as 1; a blank Unit price shows no amount.
function readParts_(ss) {
  const out = {};
  const sh = ss.getSheetByName(PARTS_SHEET);
  if (!sh) return out;
  const rows = sh.getDataRange().getValues();
  const head = rows[0].map((h) => String(h).trim());
  const w = head.indexOf('WO #'), it = head.indexOf('Item');
  const q = head.indexOf('Qty'), p = head.indexOf('Unit price');
  if (w === -1 || it === -1) throw new Error('The Parts tab needs WO # and Item headers.');
  for (const r of rows.slice(1)) {
    const key = String(r[w]).trim();
    if (key === '' || String(r[it]).trim() === '') continue;
    const qty   = q === -1 || r[q] === '' ? 1 : Number(r[q]);
    const price = p === -1 || r[p] === '' ? null : Number(r[p]);
    (out[key] = out[key] || []).push({ item: String(r[it]), qty, price, amount: price === null ? 0 : qty * price });
  }
  return out;
}

// Replaces a paragraph that is exactly {{Parts table}} with a table of this work order's lines.
function insertPartsTable_(body, lines, total) {
  for (const p of body.getParagraphs()) {
    if (p.getText().trim() !== '{{Parts table}}') continue;
    if (!lines.length) { p.setText('No parts listed.'); continue; }
    const cells = [['Item', 'Qty', 'Unit price', 'Amount']];
    for (const l of lines) {
      cells.push([l.item, String(Math.round(l.qty * 1000) / 1000),
        l.price === null ? '' : money_(l.price), l.price === null ? '' : money_(l.amount)]);
    }
    cells.push(['Total', '', '', money_(total)]);
    const table = body.insertTable(body.getChildIndex(p), cells);
    table.getRow(0).editAsText().setBold(true);
    try { p.removeFromParent(); } catch (e) { p.setText(''); } // the last paragraph can't be removed
  }
}

// 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);
  }
}

function formatValue_(header, v, tz) {
  if (v instanceof Date) return Utilities.formatDate(v, tz, DATE_FORMAT);
  if (typeof v === 'number' && CURRENCY_COLUMNS.indexOf(header) !== -1) return money_(v);
  return v === null || v === undefined ? '' : String(v);
}

function money_(n) {
  const s = Math.abs(n).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
  return (n < 0 ? '-' : '') + CURRENCY_SYMBOL + s;
}

function findInFolder_(folder, name, mimeType) {
  const files = folder.getFilesByName(name);
  while (files.hasNext()) {
    const f = files.next();
    if (f.getMimeType() === mimeType && !f.isTrashed()) return f;
  }
  return null;
}

What it does, row by row:

Running it twice. Finished rows have a PDF link, so a second run does nothing to them. If a run stopped halfway through a row (a timeout, a quota error, a closed tab), the next run finds that row's Doc from the Doc link, or from a file with the same name in the folder, and finishes it with the same work order number instead of making a second copy.

Quotas and time limits. Apps Script stops a run after six minutes, and Google limits how many documents an account can create per day (see Apps Script quotas). The script stops on its own after MAX_PER_RUN work orders or about four and a half minutes, and stops immediately on a quota error, leaving the error in that row's Doc status. Run it again later and it carries on.

Step 6: a dispatch view with formulas

A few formulas on a separate Dashboard tab turn the Jobs list into a daily board. They assume Job status in column I, Scheduled in G, Technician in F and Priority in E, as in the example; adjust the letters to your sheet.

Tips

Want work orders from rows without maintaining a script? SheetWeave (disclosure: we make it) is a Google Sheets add-on that fills a Google Docs template with each row's column values and saves a Doc, a PDF, or both in a Drive folder you choose, writing the links back to the row. It fills {{Column}} placeholders from the row; for the parts table from a second tab and automatic numbering above, use the script, or keep the parts list and the work order number in columns of their own. It is on the Google Workspace Marketplace.
See SheetWeave

Related Google Sheets guides

Instructions refer to Google Sheets, Google Docs and Apps Script as they worked on November 14, 2026. Not affiliated with Google or any other vendor named here. Google Sheets, Google Docs and Google Drive are trademarks of Google LLC. Features change, so verify in your own account. Questions or corrections: hello@loomwise.app.