How to Make Year-End Donor Giving Statements from Google Sheets: One PDF per Donor with Every Gift (2026)
Every January, small nonprofits, churches, school foundations and community groups that track donations in a Google Sheet have the same job: send each donor one statement listing everything they gave last year, with the right wording, before tax season. Done by hand, it means filtering the gift log donor by donor, copying dates and amounts into a letter, and hoping nobody's December check got missed. This guide sets up a Gifts tab with one row per gift, a few formulas that total each donor's year and catch problems before you send, and a free Apps Script that makes one PDF giving statement per donor (every gift with date, fund, method and amount, the cash total, gifts of property by description only, and the goods-or-services sentence) and can email it to them. It is safe to run again: donors who already have a statement are skipped, and if a gift is added or edited later, it tells you whose statement needs a corrected copy.
How this differs from per-gift receipts: a receipt is one document per payment, sent when the gift arrives. A year-end statement is one document per donor that adds up a whole year of gifts. Many organizations send both. If you already use donor management software, use its year-end statements; this guide is for when the sheet is your donor record.
What a year-end statement needs (US federal rules)
The IRS calls it a written acknowledgment. Per IRS Publication 1771 and the IRS page on written acknowledgments, the acknowledgment a donor needs for any single gift of $250 or more must contain:
- the name of the organization;
- the amount of any gift of money;
- a description (but not the value) of any gift of property;
- a statement that no goods or services were provided in return, if that is the case, or a description and good-faith estimate of the value of what was provided, or a statement that it consisted only of intangible religious benefits.
A few more points from the same publication that shape the script:
- One annual summary is fine. It may cover several single contributions of $250 or more. There is no IRS form; letters, computer-generated forms and emails are all acceptable, and the donor's Social Security number is not needed.
- Small gifts are not added together for the $250 rule, but the donor still needs a bank record or a written communication from you showing your name, the date and the amount for every gift of money. A statement that lists each gift with its date covers that too, which is why the script lists gifts one by one instead of printing only a total.
- Timing. The donor must receive it by the date they file their return (or its due date, if earlier). Publication 1771 notes that charities typically send acknowledgments by January 31 of the following year.
- Quid pro quo gifts. If a donor paid more than $75 partly as a gift and partly for something (a gala dinner, a concert ticket), you must tell them in writing that only the amount above the value of what they received is deductible, with a good-faith estimate of that value.
- Payroll deductions. For a single payroll-deduction gift of $250 or more, your document must say that no goods or services were provided for payroll-deduction gifts, if that is the case. The script's standard sentence says so for every gift listed.
- Property. Describe gifts of property; do not put a value on them. Further rules may apply to the donor depending on the property and the value claimed; Publication 1771 points to Form 8283 and Publication 526.
This is a summary of federal rules for US organizations, not tax advice. State rules and other countries differ; check what applies to you.
Step 1: a Gifts tab, one row per gift
Name the tab Gifts. The script finds columns by their header, so the order is up to you, and only Date, Donor and Amount are required; the formulas below assume this layout:
| Col | Header | What goes in it |
|---|---|---|
| A | Date | The date you received the gift, formatted as a date (Format › Number › Date). Text that only looks like a date won't work. |
| B | Donor ID | Optional but recommended: a stable code like D-0042. Rows with the same ID are one donor even if the name was typed differently (“Bea Okafor”, “B. Okafor”). Without IDs, rows are matched by name, ignoring capitals and extra spaces. |
| C | Donor | The name as it should appear on the statement. For a couple or household that gives together, use one name such as “Jordan and Sam Lee” and one Donor ID. |
| D | Optional; a Donors tab (Step 2) wins over it | |
| E | Amount | The amount of a gift of money, as a number. Leave it at 0 for gifts of property. |
| F | Method | Check, Cash, Card, Online, Payroll... In-kind, Property, Goods, Stock or Securities marks a gift of property: it is listed by description, without a value, and left out of the cash total. |
| G | Fund | Optional: General, Building fund, Scholarship... |
| H | Reference | Optional: check number or payment ID. Helps donors match the statement to their bank records. |
| I | Status | Blank normally. Refunded, Void, Bounced, Returned or Cancelled leaves the row out. So does Pledge: a promise is not a gift until it is paid, so log the payment as its own row. |
| J | In-kind description | For gifts of property: what was given, such as “12 cases of canned soup” or “Used laptop, 2022 model”. Required for those rows. |
| K, L | Goods/services value, Goods/services description | Only when the donor received something for the payment: the good-faith estimate of its value and what it was (“Gala dinner ticket”). Leave both blank otherwise. |
| M | Cash 2026 | Formula (Step 3); the script ignores it |
Record refunds by setting Status on the original gift, not with a negative row. The script reports negative amounts instead of guessing which gift they cancel. If donations arrive through an online form or payment tool, paste or import its export into these columns once a month so the year-end run has everything.
Step 2 (optional): a Donors tab for addresses and greetings
Add a tab named Donors with a header row of Donor ID or Donor (or both), plus any of Email, Address and Greeting. Put the whole mailing address in one cell, with line breaks (Ctrl+Enter or ⌘+Enter inside the cell) between lines; each line prints under the donor's name. Greeting is how the letter opens (“Dear Avery,”); blank means the donor's name. When the Gifts tab uses Donor IDs, the Donors tab's Donor column also sets the name printed on the statement, so a name fixed there is fixed everywhere.
Step 3: totals per donor, and checks before you send
In M1 type Cash 2026 and in M2 paste this, then fill it down. It is the gift's amount if it is a 2026 gift of money that counts, and 0 otherwise, using the same rules as the script:
=IF(A2="", "", IF(AND(YEAR(A2) = 2026, NOT(REGEXMATCH(LOWER(I2), "^(refunded|void|voided|bounced|returned|cancelled|canceled|pledge)$")), NOT(REGEXMATCH(LOWER(F2), "^(in-kind|in kind|noncash|non-cash|property|goods|stock|securities)$"))), N(E2), 0))
Each donor's year, largest total first, on a new tab:
=QUERY(Gifts!A1:M, "select C, sum(M), count(M), max(M) where M > 0 group by C order by sum(M) desc label sum(M) 'Total 2026', count(M) 'Gifts', max(M) 'Largest gift'", 1)
QUERY groups by the exact name, so “Avery Lane” and “avery lane” show up as two lines here while the script treats them as one donor. Two lines for one person is your cue to fix the spelling or give the rows a Donor ID. For a single donor, use =SUMIFS(Gifts!M:M, Gifts!C:C, "Avery Lane"), or Gifts!B:B and the ID.
Checks worth running the week before you send:
Total of all 2026 gifts of money (compare with your deposits):
=SUM(Gifts!M2:M)
How many single gifts were $250 or more:
=COUNTIF(Gifts!M2:M, ">=250")
Payments over $75 where the donor received something (they need the quid pro quo wording):
=IFERROR(FILTER({Gifts!A2:A, Gifts!C2:C, Gifts!E2:E, Gifts!K2:K, Gifts!L2:L}, Gifts!K2:K > 0, Gifts!E2:E > 75), "None")
Check numbers or payment IDs entered twice:
=IFERROR(UNIQUE(FILTER(Gifts!H2:H, Gifts!H2:H <> "", COUNTIF(Gifts!H2:H, Gifts!H2:H) > 1)), "No duplicates")
Two conditional formatting rules on A2:M (Format › Conditional formatting › Custom formula is) highlight rows the script would skip: =AND(N($K2) > 0, $L2 = "") for a goods/services value with no description, and =AND(REGEXMATCH(LOWER($F2), "^(in-kind|in kind|noncash|non-cash|property|goods|stock|securities)$"), $J2 = "") for a gift of property with no description.
Step 4: the script (one PDF statement per donor)
Create a Drive folder for the statements and copy its ID (the part of the folder's URL after /folders/). Open Extensions › Apps Script, paste the script below, and set FOLDER_ID, TAX_YEAR, ORG_NAME, ORG_LINES and SIGNED_BY (and ORG_EIN if you print it on receipts). Then:
- Reload the spreadsheet and run Giving statements › Make year-end statements, approving the permissions the first time.
PREVIEWistrue, so it makes at most 3 PDFs named “PREVIEW ...”, sends nothing to donors and logs nothing. - Open the previews and check them against the sheet: names, dates, totals, the wording. Delete them when you're happy.
- Set
PREVIEW = false, save and run it again. It makes one PDF per donor, alphabetically, and records each one on a Statement log tab. If you have more donors thanMAX_PER_RUN(25), run it again; finished donors are skipped.
// Year-end giving statements from a Google Sheets gift log: one PDF per donor listing every
// gift in the tax year (date, fund, method, amount), the cash total, non-cash gifts by
// description only, and the goods-or-services wording a written acknowledgment needs.
// Sheet: a Gifts tab with a header row (Date, Donor, Amount, plus optional Donor ID, Email,
// Method, Fund, Reference, Status, In-kind description, Goods/services value and
// Goods/services description) and an optional Donors tab (Donor or Donor ID, Email, Address,
// Greeting). The script only reads those tabs; it writes to its own "Statement log" tab.
const FOLDER_ID = 'PASTE_DRIVE_FOLDER_ID'; // Drive folder for the PDFs
const TAX_YEAR = 2026; // the calendar year the statements cover
const GIFTS_SHEET = 'Gifts';
const DONORS_SHEET = 'Donors'; // optional: Email, Address and Greeting per donor
const LOG_SHEET = 'Statement log'; // created on the first real run
const ORG_NAME = 'Your organization name';
const ORG_LINES = ['Street address', 'City, State ZIP', 'donations@yourorg.example']; // printed under the name
const ORG_EIN = ''; // optional, e.g. '12-3456789'; printed if filled in
const SIGNED_BY = 'Name, Title'; // printed under the closing
const CURRENCY = '$';
const MIN_TOTAL = 0; // skip donors whose cash total is below this (non-cash gifts still count)
const RELIGIOUS_BENEFITS_ONLY = false; // true = "other than intangible religious benefits" wording
const EMAIL_STATEMENTS = false; // true = email each PDF to the donor's Email
const PREVIEW = true; // true = at most 3 PDFs named "PREVIEW ...", emails only to you, no log
const REPLY_TO = ''; // optional reply-to address for donor emails
const MAX_PER_RUN = 25; // run again to continue; finished donors are skipped
const MAX_MINUTES = 4.5; // stop before Apps Script's 6-minute limit
const KEEP_DOCS = false; // false = keep only the PDF, not the Google Doc
const NONCASH_METHODS = ['in-kind', 'in kind', 'noncash', 'non-cash', 'property', 'goods', 'stock', 'securities'];
const SKIP_STATUSES = ['refunded', 'void', 'voided', 'bounced', 'returned', 'cancelled', 'canceled', 'pledge'];
const DAY = 86400000;
const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
'October', 'November', 'December'];
function onOpen() {
SpreadsheetApp.getUi().createMenu('Giving statements')
.addItem('Make year-end statements', 'makeGivingStatements')
.addToUi();
}
function makeGivingStatements(now) {
let ui = null;
if (!(now instanceof Date)) { // run from the menu or a trigger
now = new Date();
try { ui = SpreadsheetApp.getUi(); } catch (e) { ui = null; } // no UI when a trigger runs it
}
const lock = LockService.getDocumentLock();
if (!lock.tryLock(30000)) return; // another run is still busy
try {
const result = run_(now, Date.now());
if (ui) ui.alert(summary_(result));
return result;
} finally {
lock.releaseLock();
}
}
function run_(now, startedMs) {
if (!/^\d{4}$/.test(String(TAX_YEAR))) throw new Error('Set TAX_YEAR to a year such as 2026.');
const ss = SpreadsheetApp.getActive();
const tz = ss.getSpreadsheetTimeZone();
const giftSheet = ss.getSheetByName(GIFTS_SHEET);
if (!giftSheet) throw new Error('No tab named ' + GIFTS_SHEET + '.');
const gifts = readGifts_(giftSheet.getDataRange().getValues(), tz);
const donorSheet = ss.getSheetByName(DONORS_SHEET);
const contacts = donorSheet ? readDonors_(donorSheet.getDataRange().getValues()) : {};
const donors = buildDonors_(gifts.rows, contacts);
let log = ss.getSheetByName(LOG_SHEET);
const done = PREVIEW || !log ? {} : readLog_(log.getDataRange().getValues());
const res = { year: Number(TAX_YEAR), preview: PREVIEW, made: 0, emailed: 0, alreadyDone: 0, changed: [],
left: 0, quota: false, timeUp: false, noEmail: [], belowMin: donors.belowMin, skippedRows: gifts.skipped, pdfs: [] };
const todo = [];
donors.list.forEach(function (d) {
const prev = done[TAX_YEAR + '|' + d.key];
if (!prev) { todo.push(d); return; }
res.alreadyDone++;
if (prev !== fingerprint_(d)) res.changed.push(d.name); // a gift was added or edited after its statement
});
if (!todo.length) return res;
const folder = DriveApp.getFolderById(FOLDER_ID);
const me = Session.getEffectiveUser().getEmail();
const limit = PREVIEW ? Math.min(3, MAX_PER_RUN) : MAX_PER_RUN;
const today = dayNum_(Utilities.formatDate(now, tz, 'yyyy-MM-dd'));
for (let i = 0; i < todo.length; i++) {
const d = todo[i];
if (res.made >= limit) { res.left = todo.length - i; break; }
if (Date.now() - startedMs > MAX_MINUTES * 60000) { res.left = todo.length - i; res.timeUp = true; break; }
const emails = EMAIL_STATEMENTS ? emails_(d.email) : null;
const to = emails ? (PREVIEW ? [me] : emails) : [];
if (to.length && MailApp.getRemainingDailyQuota() < to.length) {
res.left = todo.length - i; res.quota = true; break; // tomorrow's run continues here
}
const made = makePdf_(folder, d, today, PREVIEW ? 'PREVIEW ' : '');
res.made++;
res.pdfs.push(made.url);
let note = EMAIL_STATEMENTS ? '' : 'emailing off';
if (EMAIL_STATEMENTS && !emails) { res.noEmail.push(d.name); note = 'no valid Email'; }
if (to.length) {
MailApp.sendEmail(mail_(d, made.blob, to, emails));
res.emailed++;
}
if (!PREVIEW) {
if (!log) {
log = ss.insertSheet(LOG_SHEET);
log.appendRow(['Tax year', 'Donor key', 'Donor', 'Cash total', 'Gifts', 'Check', 'PDF', 'Emailed to', 'Note', 'Made at']);
}
log.appendRow([Number(TAX_YEAR), d.key, d.name, d.cash / 100, d.gifts.length, fingerprint_(d), made.url,
to.length ? emails.join(', ') : '', note, Utilities.formatDate(now, tz, 'yyyy-MM-dd HH:mm')]);
SpreadsheetApp.flush(); // the log survives even if a later donor fails
}
}
return res;
}
function readGifts_(values, tz) {
const col = finder_(values[0]);
const c = { date: col('Date'), donor: col('Donor'), id: col('Donor ID'), email: col('Email'), amount: col('Amount'),
method: col('Method'), fund: col('Fund'), ref: col('Reference'), status: col('Status'),
item: col('In-kind description'), gsValue: col('Goods/services value'), gsDesc: col('Goods/services description') };
if (c.date < 0 || c.donor < 0 || c.amount < 0) {
throw new Error('The ' + GIFTS_SHEET + ' tab needs Date, Donor and Amount columns (the others are optional).');
}
const text = function (v, k) { return k < 0 || v[k] === null || v[k] === undefined ? '' : String(v[k]).trim(); };
const rows = [], skipped = [];
for (let i = 1; i < values.length; i++) {
const v = values[i];
const donor = text(v, c.donor).replace(/\s+/g, ' ');
const rawAmount = text(v, c.amount);
if (!donor && !rawAmount && !text(v, c.date)) continue; // empty row
const where = 'row ' + (i + 1) + ': ';
const day = toDay_(v[c.date], tz);
if (day === null) { skipped.push(where + 'Date is not a date'); continue; }
if (ymd_(day).y !== Number(TAX_YEAR)) continue; // another year
if (SKIP_STATUSES.indexOf(text(v, c.status).toLowerCase()) >= 0) continue; // refunded, void, pledge...
if (!donor) { skipped.push(where + 'no Donor'); continue; }
const method = text(v, c.method);
const noncash = NONCASH_METHODS.indexOf(method.toLowerCase()) >= 0;
const item = text(v, c.item);
let cents = 0;
if (noncash) {
if (!item) { skipped.push(where + 'non-cash gift needs an In-kind description'); continue; }
} else {
const n = typeof v[c.amount] === 'number' ? v[c.amount] : number_(rawAmount);
if (isNaN(n)) { skipped.push(where + 'Amount is not a number'); continue; }
if (n <= 0) { skipped.push(where + 'Amount is zero or negative (mark refunds in Status instead)'); continue; }
cents = Math.round(n * 100);
}
const gsRaw = text(v, c.gsValue);
const gs = gsRaw === '' ? 0 : (typeof v[c.gsValue] === 'number' ? v[c.gsValue] : number_(gsRaw));
if (isNaN(gs) || gs < 0) { skipped.push(where + 'Goods/services value is not a number'); continue; }
const gsCents = Math.round(gs * 100);
if (gsCents > 0 && !text(v, c.gsDesc)) { skipped.push(where + 'Goods/services value needs a Goods/services description'); continue; }
const id = text(v, c.id);
rows.push({ row: i + 1, day: day, donor: donor, key: id ? 'id:' + id.toLowerCase() : 'name:' + donor.toLowerCase(),
email: text(v, c.email), method: method, fund: text(v, c.fund), ref: text(v, c.ref), noncash: noncash,
item: item, cents: cents, gsCents: gsCents, gsDesc: text(v, c.gsDesc) });
}
return { rows: rows, skipped: skipped };
}
function readDonors_(values) {
const col = finder_(values[0]);
const c = { donor: col('Donor'), id: col('Donor ID'), email: col('Email'), address: col('Address'), greeting: col('Greeting') };
if (c.donor < 0 && c.id < 0) throw new Error('The ' + DONORS_SHEET + ' tab needs a Donor or Donor ID column.');
const out = {};
for (let i = 1; i < values.length; i++) {
const v = values[i];
const get = function (k) { return k < 0 || v[k] === null || v[k] === undefined ? '' : String(v[k]).trim(); };
const info = { email: get(c.email), address: get(c.address), greeting: get(c.greeting), name: get(c.donor).replace(/\s+/g, ' ') };
if (get(c.id)) out['id:' + get(c.id).toLowerCase()] = info;
if (info.name) out['name:' + info.name.toLowerCase()] = out['name:' + info.name.toLowerCase()] || info;
}
return out;
}
function buildDonors_(rows, contacts) {
const by = {}, order = [];
rows.forEach(function (g) {
if (!by[g.key]) { by[g.key] = { key: g.key, name: g.donor, email: '', gifts: [] }; order.push(g.key); }
const d = by[g.key];
d.gifts.push(g);
if (g.email) d.email = g.email; // the latest gift row with an Email wins
});
const list = [], belowMin = [];
order.forEach(function (k) {
const d = by[k];
d.gifts.sort(function (a, b) { return a.day - b.day || a.row - b.row; });
const info = contacts[k] || contacts['name:' + d.name.toLowerCase()] || {};
if (info.name && k.indexOf('id:') === 0) d.name = info.name;
if (info.email) d.email = info.email; // the Donors tab wins over gift rows
d.address = info.address ? info.address.split(/\r?\n/).map(function (x) { return x.trim(); }).filter(String) : [];
d.greeting = info.greeting || d.name;
d.cash = d.gifts.reduce(function (s, g) { return s + g.cents; }, 0);
d.gsTotal = d.gifts.reduce(function (s, g) { return s + g.gsCents; }, 0);
d.hasNoncash = d.gifts.some(function (g) { return g.noncash; });
if (d.cash < Math.round(MIN_TOTAL * 100) && !d.hasNoncash) { belowMin.push(d.name); return; }
list.push(d);
});
list.sort(function (a, b) { return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : a.name.toLowerCase() > b.name.toLowerCase() ? 1 : 0; });
return { list: list, belowMin: belowMin };
}
// Changes when a gift is added, removed or edited, so a re-run can tell you which statements are out of date.
function fingerprint_(d) {
const text = d.gifts.map(function (g) { return [g.day, g.cents, g.gsCents, g.fund, g.item].join(':'); }).join('|');
let h = 5381;
for (let i = 0; i < text.length; i++) h = (h * 33 + text.charCodeAt(i)) % 2147483647;
return 'v' + d.gifts.length + '/' + d.cash + '/' + h.toString(36);
}
function readLog_(values) {
const out = {};
for (let i = 1; i < values.length; i++) out[String(values[i][0]) + '|' + String(values[i][1])] = String(values[i][5]);
return out;
}
function makePdf_(folder, d, today, prefix) {
const name = prefix + TAX_YEAR + ' giving statement - ' + d.name.replace(/[\\\/:*?"<>|]/g, '-');
const old = folder.getFilesByName(name + '.pdf');
while (old.hasNext()) old.next().setTrashed(true); // a re-made statement replaces the old PDF
const doc = DocumentApp.create(name);
const file = DriveApp.getFileById(doc.getId());
file.moveTo(folder);
render_(doc.getBody(), d, today);
doc.saveAndClose();
const blob = file.getAs('application/pdf').setName(name + '.pdf');
const pdf = folder.createFile(blob);
if (!KEEP_DOCS) file.setTrashed(true);
return { name: name, blob: blob, url: pdf.getUrl() };
}
function render_(body, d, today) {
const H = DocumentApp.ParagraphHeading;
body.setMarginTop(54).setMarginBottom(54).setMarginLeft(54).setMarginRight(54);
const first = body.getParagraphs()[0];
first.setText(ORG_NAME);
first.setHeading(H.HEADING1);
ORG_LINES.concat(ORG_EIN ? ['EIN ' + ORG_EIN] : []).forEach(function (line) { body.appendParagraph(line).setHeading(H.NORMAL); });
body.appendParagraph(TAX_YEAR + ' giving statement').setHeading(H.HEADING2);
body.appendParagraph(show_(today)).setHeading(H.NORMAL);
[d.name].concat(d.address).forEach(function (line) { body.appendParagraph(line).setHeading(H.NORMAL); });
body.appendParagraph('Dear ' + d.greeting + ',').setHeading(H.NORMAL);
body.appendParagraph('Thank you for your generosity. This statement lists every gift ' + ORG_NAME +
' received from you between January 1 and December 31, ' + TAX_YEAR + '. Please keep it with your tax records.').setHeading(H.NORMAL);
const cash = d.gifts.filter(function (g) { return !g.noncash; });
if (cash.length) {
body.appendParagraph('Gifts of money').setHeading(H.HEADING3);
const showGs = d.gsTotal > 0;
const head = ['Date received', 'Fund', 'Method', 'Reference', 'Amount'];
if (showGs) head.push('Goods or services you received (estimated value)');
const rows = [head];
cash.forEach(function (g) {
const r = [show_(g.day), g.fund, g.method, g.ref, money_(g.cents)];
if (showGs) r.push(g.gsCents ? g.gsDesc + ' (' + money_(g.gsCents) + ')' : 'None');
rows.push(r);
});
const total = ['Total', '', '', '', money_(d.cash)];
if (showGs) total.push(d.gsTotal ? money_(d.gsTotal) : '');
rows.push(total);
table_(body, rows, [4], true).getRow(rows.length - 1).editAsText().setBold(true);
}
const noncash = d.gifts.filter(function (g) { return g.noncash; });
if (noncash.length) {
body.appendParagraph('Gifts of property (described, not valued)').setHeading(H.HEADING3);
const rows = [['Date received', 'Description', 'Goods or services you received (estimated value)']];
noncash.forEach(function (g) { rows.push([show_(g.day), g.item, g.gsCents ? g.gsDesc + ' (' + money_(g.gsCents) + ')' : 'None']); });
table_(body, rows, [], true);
body.appendParagraph('We do not state a value for gifts of property; the value you claim is for you and your tax advisor to determine.').setHeading(H.NORMAL);
}
disclosure_(d).forEach(function (p) { body.appendParagraph(p).setHeading(H.NORMAL); });
body.appendParagraph('With gratitude,').setHeading(H.NORMAL);
body.appendParagraph(SIGNED_BY).setHeading(H.NORMAL);
body.appendParagraph(ORG_NAME).setHeading(H.NORMAL);
}
// The goods-or-services sentence(s) a written acknowledgment needs (IRS Publication 1771).
function disclosure_(d) {
const none = RELIGIOUS_BENEFITS_ONLY
? 'No goods or services were provided in exchange for these contributions other than intangible religious benefits.'
: 'No goods or services were provided in exchange for these contributions.';
if (!d.gsTotal) return [none];
const out = ['Where the table shows goods or services you received, the amount you can deduct for federal income tax ' +
'purposes is limited to the money (and the value of any property) you gave minus the estimated value of those goods or ' +
'services: ' + money_(d.gsTotal) + ' in total for ' + TAX_YEAR + '.'];
out.push(RELIGIOUS_BENEFITS_ONLY
? 'For all other gifts listed, no goods or services were provided other than intangible religious benefits.'
: 'No goods or services were provided in exchange for the other gifts listed.');
return out;
}
function table_(body, cells, rightCols, boldHeader) {
const t = body.appendTable(cells);
if (boldHeader) t.getRow(0).editAsText().setBold(true);
for (let r = 0; r < cells.length; r++) {
rightCols.forEach(function (c) {
t.getCell(r, c).getChild(0).asParagraph().setAlignment(DocumentApp.HorizontalAlignment.RIGHT);
});
}
return t;
}
function mail_(d, blob, to, emails) {
const total = d.cash ? 'Your gifts of money in ' + TAX_YEAR + ' total ' + money_(d.cash) + '.' : '';
const m = {
to: to.join(','),
subject: (PREVIEW ? '[PREVIEW to ' + emails.join(', ') + '] ' : '') +
'Your ' + TAX_YEAR + ' giving statement from ' + ORG_NAME,
body: 'Dear ' + d.greeting + ',\n\nThank you for supporting ' + ORG_NAME + ' in ' + TAX_YEAR +
'. Attached is your giving statement listing each gift we received from you this year.' +
(total ? ' ' + total : '') + '\n\nPlease keep it with your tax records. If anything looks wrong, just reply and we will correct it.\n\n' +
SIGNED_BY + '\n' + ORG_NAME,
name: ORG_NAME,
attachments: [blob]
};
if (REPLY_TO) m.replyTo = REPLY_TO;
return m;
}
function summary_(r) {
const out = [(r.preview ? 'PREVIEW: ' : '') + r.made + ' giving statement PDF(s) for ' + r.year + '.' +
(r.emailed ? ' Emailed ' + r.emailed + (r.preview ? ' (to you only).' : '.') : '')];
if (r.alreadyDone) out.push(r.alreadyDone + ' donor(s) already had a statement for ' + r.year + ' (see the ' + LOG_SHEET + ' tab).');
if (r.changed.length) out.push('Gifts changed after the statement was made, so these may need a corrected one ' +
'(delete their row in ' + LOG_SHEET + ' and run again): ' + r.changed.join(', '));
if (r.left) out.push(r.left + ' donor(s) left' + (r.quota ? ' (daily email quota reached)' : r.timeUp ? ' (time limit)' : '') + '. Run it again to continue.');
if (r.noEmail.length) out.push('No valid Email, PDF made but not sent: ' + r.noEmail.join(', '));
if (r.belowMin.length) out.push('Below MIN_TOTAL, no statement: ' + r.belowMin.join(', '));
if (r.skippedRows.length) out.push('Gift rows skipped:\n' + r.skippedRows.slice(0, 15).join('\n') +
(r.skippedRows.length > 15 ? '\n...and ' + (r.skippedRows.length - 15) + ' more' : ''));
return out.join('\n\n');
}
// ---- small helpers ----
function finder_(header) {
const h = (header || []).map(function (x) { return String(x).trim().toLowerCase(); });
return function (name) { return h.indexOf(name.toLowerCase()); };
}
function emails_(s) {
const list = String(s || '').split(/[,;]/).map(function (x) { return x.trim(); }).filter(String);
const ok = list.length > 0 && list.every(function (x) { return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x); });
return ok ? list : null;
}
function number_(s) {
const t = String(s).replace(/[\s,]/g, '').split(CURRENCY).join('');
return /^-?\d+(\.\d+)?$/.test(t) ? Number(t) : NaN;
}
function toDay_(v, tz) {
if (v instanceof Date) return isNaN(v.getTime()) ? null : dayNum_(Utilities.formatDate(v, tz, 'yyyy-MM-dd'));
return typeof v === 'string' ? dayNum_(v.trim()) : null;
}
// Dates are whole days counted from 1970-01-01, so time zones and daylight saving can't shift them.
function dayNum_(s) {
const m = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(String(s));
if (!m) return null;
const n = Date.UTC(+m[1], +m[2] - 1, +m[3]) / DAY;
const back = ymd_(n);
return back.y === +m[1] && back.m === +m[2] && back.d === +m[3] ? n : null;
}
function ymd_(n) {
const d = new Date(n * DAY);
return { y: d.getUTCFullYear(), m: d.getUTCMonth() + 1, d: d.getUTCDate() };
}
function show_(n) {
const t = ymd_(n);
return MONTHS[t.m - 1] + ' ' + t.d + ', ' + t.y;
}
function money_(cents) {
const abs = Math.abs(cents);
const whole = String(Math.floor(abs / 100)).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return (cents < 0 ? '-' : '') + CURRENCY + whole + '.' + String(abs % 100).padStart(2, '0');
}
What the script does
- Every gift, listed. Each statement opens with your organization's name and address lines, the statement date, the donor's name and address and a greeting, then a table of gifts of money in date order (date received, fund, method, reference, amount) with the year's total, and a separate table of gifts of property described but not valued. Only gifts dated in
TAX_YEARcount, by the date in the cell in the spreadsheet's time zone. - The right goods-or-services sentence. If no gift on the statement has a Goods/services value, it says “No goods or services were provided in exchange for these contributions.” If some do, the table gets a column showing what the donor received and its estimated value (“None” for the others), and a sentence explains that the deductible amount is limited to what they gave minus that value, with the year's total of those values. Set
RELIGIOUS_BENEFITS_ONLY = truefor the “other than intangible religious benefits” wording. - Rows it can't use are reported, not guessed. The summary lists them by row number: a date that isn't a date, no donor, an amount that isn't a number or is negative, a gift of property without a description, a goods/services value without a description. Refunded, void and pledge rows and other years are left out quietly.
- Safe to run again. The log records each donor's statement with the total, the number of gifts and a check value. A rerun skips donors already done. If a gift was added or edited after a donor's statement was made (a check that arrived on December 31 and was entered in January, a corrected amount), the summary names that donor; delete their row on the Statement log tab and run it again to make a corrected statement, which replaces the old PDF in the folder. A document lock stops two runs overlapping, and it stops after 4.5 minutes so it never hits Apps Script's 6-minute limit mid-statement.
- PDF only, unless you want the Doc. It builds each statement in a temporary Google Doc, saves the PDF to your folder and moves the Doc to the trash. Set
KEEP_DOCS = trueto keep the Docs for editing. - Small donors.
MIN_TOTAL = 0makes a statement for everyone who gave anything. Some organizations only send statements above an amount; donors who gave property always get one.
Step 5: emailing the statements
Email is an accepted way to deliver acknowledgments. Set EMAIL_STATEMENTS = true and the script emails each donor their PDF as an attachment, from your account with ORG_NAME as the sender name, with a short thank-you that mentions the year's total. Replies go to REPLY_TO if you set one. Try it with PREVIEW = true first: preview emails come only to you, with the real recipient in the subject.
Donors with no valid email address still get a PDF (to print and mail), and the summary lists them. The script checks your daily Apps Script email quota before each email (100 recipients a day on a consumer Gmail account, 1,500 on Google Workspace) and stops when it would run out; the next day's run carries on with the donors who are left.
Tips
- Start the year with a clean sheet. Keep one Gifts tab across years (the script only reads
TAX_YEAR), or a copy of the spreadsheet per year. ChangeTAX_YEARand the 2026 in the formulas each January. - Late December gifts. Enter every gift before you run the statements. Checks mailed in late December that arrive in January are a common question; record them the way your bookkeeper or tax advisor advises, and do it the same way every year. If a gift turns up after the statements went out, the rerun tells you whose statement changed.
- Mid-year statements. Some donors want a summary in the summer. Run it with
PREVIEW = trueto make PDFs without logging them, or keep the log and delete those rows before the real year-end run. - Keep it private. The folder of statements is a list of who gave what. Share it only with the people who need it, and don't put the sheet's link in donor emails (the script doesn't).
- Ownership. The emails come from whoever runs the script, so set it up from a shared organization account rather than one volunteer's personal one.
- Thank-you letters without a gift list. For a branded letter per donor that only needs the total, see the box below.
=SUMIFS(Gifts!M:M, Gifts!B:B, A2) when column A holds the Donor ID) and it makes one branded thank-you or year-end summary letter per donor from your own template, with your logo and wording. For the gift-by-gift table, use the script above. 14-day free trial, no credit card to start. SheetWeave is on the Google Workspace Marketplace.See SheetWeave
Related Google Sheets guides
- How to generate a PDF or Google Doc for each row in Google Sheets
- Find and remove duplicates in Google Sheets
- Compare two columns or two sheets for duplicates
- Find case-insensitive and fuzzy duplicates in Google Sheets
- Remove and highlight duplicates in Google Sheets with SheetDupes
- Best Autocrat alternatives for mail merge to PDF and Docs
- Make invoices or certificates from Google Sheets rows
- Create sales quotes or estimates from Google Sheets
- Generate receipts from Google Sheets rows
- Create purchase orders from Google Sheets
- Make packing slips from Google Sheets orders
- Generate a PDF certificate from a Google Form response
- Issue numbered training completion certificates with expiry dates
- Make a PDF progress report for each student
- Generate offer letters from a Google Sheets hiring tracker
- Generate contracts and agreements from a Google Docs template
- Make work orders for service jobs from Google Sheets
- Email each row’s PDF as an attachment
- Automatic email reminders from a date column
- Contract renewal and expiration alerts from Google Sheets
- Track certificate of insurance (COI) expirations in Google Sheets
- Track employee license and certification expirations
- Track equipment and vehicle maintenance with reminders
- Equipment sign-out sheet with due-back and overdue reminders
- Track warranty expiration dates with reminders
- Birthday and work anniversary reminders from Google Sheets
- Rent due and lease renewal reminders from Google Sheets
- Send invoice payment reminders from Google Sheets
- Highlight overdue tasks and send email reminders
- Follow-up reminders for leads, clients and candidates
- Membership renewal reminders for clubs and associations
- Appointment reminder emails for clients
- Probation and performance review reminders for managers
- Inventory expiration dates with email alerts
- Domain and SSL certificate renewal reminders
- Name badges and place cards from a guest list
- Vehicle registration, inspection and insurance reminders
- Event sign-in sheets and table seating lists
- Pet vaccination expiry reminders for owners
- Customer account statements with aging
- Subscription tracker with renewal and free-trial reminders
- Mailing labels: one per household, clean addresses
- Volunteer shifts: open slots, reminders and rosters
- Volunteer hours verification letters, one PDF per request
- Instrument calibration due dates with email reminders
- Pay stubs from a payroll sheet, one PDF per employee
- Gift certificates with codes, balances and a redemption log
- Bill due dates: mark paid, 30-day totals and reminders
- Grant deadlines: LOIs, reports, owners and reminders
- Passport expiry: trips, the 6-month rule and renewal reminders
- Class rosters: one PDF per class, A–Z, with seat counts
- Insurance renewals: premium changes and reminders
- Onboarding checklists: tasks from start dates, owner reminders
- Raffle tickets: numbered stubs, seller books, sales tracker
- SheetWeave vs Autocrat
- SheetWeave vs Document Studio
- SheetWeave vs RowDocs
Instructions refer to Google Sheets, Google Docs, Google Drive and Apps Script as they worked on November 16, 2026, and to the IRS and Google pages cited as they stood that day. Not tax, accounting or legal advice, and not affiliated with Google or the IRS. Google Sheets, Google Docs and Google Drive are trademarks of Google LLC. Check the statements against your own records before sending them. Questions or corrections: hello@loomwise.app.