This Script Eats Glass and Smiles // AUTOMATED CHECK SIGNOFFS

>> NODE: ctrlaltcorp.dev

>> AUTHOR: HOTCHIP

>> TIME: [20251010-0900]

Paperwork: the ghost of a dead tree, haunting the living with pointless ritual.

The Corp® told me everything was secure. They called the paperwork "best practice."

>>Cute.
Back in February 2023 I duct-taped something together so a payroll could hand a physical check to a human and collect a signature without invoking an entire platform migration. It was small, it worked, and it lived. That's the point reliability > elegance.

This thing, in one sentence

Copy a Docs template, read the Data sheet, sort by location, make a grouped document with NAME / DATE / CHECK / SIGNATURE rows, hand it off to the printer. Humans sign. Job done.

Why I wrote it

Because people still want to physically sign things. Because payroll doesn’t want CSVs! They want a single, printable page per location. Because infrastructure can be overthought and overengineered. Because operations need a lever they can pull without calling six teams at 9PM.

How it behaves (Operator log)

  1. Make a copy of a Docs template into a destination folder.
  2.   >> [2023-02-14 03:17] cron: none,  run manually from spreadsheet menu
  3. Read the sheet (display values so dates look human).
  4.   >> [2023-02-14 03:17] Template: locked (owner only)
  5. Sort rows by the location column so rows group together.
  6.   >> [2023-02-14 03:17] rows: 214
  7. Walk the rows; when the location changes, add a header and a fresh table; append rows with a long signature line.
  8.   >> [2023-02-14 03:17] destinationFolder: /Payroll/SignDocs
  9. Save, close, and display a clickable link in a dialog for payroll to open and print.
  10.   >> [2023-02-14 03:19] saved: Sign Doc 2-14-2023.docx (link presented)

Snippets

Here’s a sanitized taste of the script’s structure so you know what you’re reading when you open it in the editor. Nothing dangerous. Just logic.


// copy template to destination
const googleDocTemplate = DriveApp.getFileById('TEMPLATE_ID');
const destinationFolder = DriveApp.getFolderById('DEST_ID');
const docCopy = googleDocTemplate.makeCopy("Sign Doc "+ theDate(), destinationFolder);
const doc = DocumentApp.openById(docCopy.getId());

// read and sort
sheet.setFrozenRows(1);
sheet.sort(6, true); // sort by column 6 (location)
sheet.setFrozenRows(0);
const rows = sheet.getDataRange().getDisplayValues();

// iterate rows, insert header/table when location changes
rows.forEach(function(row, index) {
    if (index === 0) return; // skip header

    if (index === 1) { /* init header & table */ }

    if (where !== row[4]) { /* page break + new header + new table */ }

    // append row into table with signature cell
});

doc.saveAndClose();
  

You can view the full, sanitized script on GitHub.

Why this survived production

Where the ugliness lives (and why I accepted it)

Admin checklist

If you inherit this script (and you will, in some form)

Don’t rewrite it on your first Monday. Run it. Read the output. Add one small sanity check that the header row contains the expected column names. That tiny telemetry will save you a support ticket and a panic in the payroll kernal.

Final thoughts

Architecture porn is sexy. Duct tape is reliable. This script isn’t a manifesto about microservices or cloud-native purity—it’s a tool in the toolbox that kepts payroll moving and checks signed. It’s ugly, but it works. That’s a kind of ugly I respect.

 >> END OF TRANSMISSION 

- HotChip

Note: This post is a retrospective/operational write-up. No exploit code or sensitive data is published here. This is not financial advice. This is not legal advice. This is not Corp® advice. This is not medical advice. This is not a joke.