Skip to content

How to Email Each Parent Their Child's Report Card PDF Automatically

A school office was looking for a way to send the same letter to every parent. Each email must carry that child’s report card as a PDF attachment. Picking the file from Google Drive for each row takes too long for a whole school. The school wanted a formula to pick the files.

Mail Merge can attach the files with a formula. You type the formula once in the File Attachments column. For every row, the formula joins a folder path, the student ID and the .pdf extension into a file name. Mail Merge then finds the file with that name in Google Drive and attaches the file to that parent’s email.

The school needed How Mail Merge does it
One letter, the same for every parent You write one template with merge fields for the names
A different PDF for each parent The File Attachments column names the file for each row
No picking of files by hand One formula builds every file name
A formula that joins text, with no script The formula joins the parts with &, as in any spreadsheet

The same formula works for any file that follows a naming pattern, such as payslips, invoices, certificates and fee statements.

Grace works in the office at Maple Ridge School. She sends the same letter to the parents of 420 students, and each email needs that child’s report card. The school’s records system exports each report card as a PDF named after the student ID, such as 10482.pdf.

Grace uploads the PDFs to Google Drive, in one folder for each grade:

Report Cards/Term 1/Grade 6/10517.pdf
Report Cards/Term 1/Grade 8/10482.pdf

Her sheet has one row for each student. Row 1 holds the column titles:

A: Parent Name B: Email Address C: Student D: Student ID E: Grade F: File Attachments
Ada ada@example.com Daniel Okafor 10482 8
Luis luis@example.com Sofia Marquez 10517 6
  1. Click F2, the first cell below the File Attachments title. If your sheet has no column with that title, type File Attachments in the first empty cell of row 1.

  2. Enter this formula. The formula joins the folder path, the grade in column E, the student ID in column D and the extension .pdf:

    =IF(D2="", "", "Report Cards/Term 1/Grade " & E2 & "/" & D2 & ".pdf")
    Output
    Report Cards/Term 1/Grade 8/10482.pdf
  3. Select F2, then drag the small blue dot at its bottom-right corner down to the last student. Each row now shows the path of that student’s PDF.

Each & joins two parts. Text goes in quotes, and a cell reference such as D2 adds the value of that cell. The IF leaves the cell empty for a row with no student ID.

Google Sheet

First NameFile Attachments
AdaReport Cards/Term 1/Grade 8/10482.pdf
LuisReport Cards/Term 1/Grade 6/10517.pdf

Emails sent

  • To: Adapdf10482.pdf
  • To: Luispdf10517.pdf
The formula writes each row's path from the grade and the student ID, and each parent gets their own child's report card.

To fill all 420 rows with one formula, put this formula in F2 and leave the cells below it empty:

=ARRAYFORMULA(IF(D2:D="", "", "Report Cards/Term 1/Grade " & E2:E & "/" & D2:D & ".pdf"))

The path follows the folder names in Google Drive, with a slash between each folder. The path doesn’t need to start at My Drive. See how to attach files by name or folder path for the rules.

  1. Go to Extensions > Mail Merge with Attachments > Open Mail Merge and click Start mail merge. Name the campaign Term 1 report cards and choose the student tab under Source Worksheet.

  2. Type the school’s name in Sender name and choose Email Address under Send to.

  3. Write the letter once, with a merge field for each value that changes:

    Subject
    {{Student}}'s Term 1 report card
    Message Body
    Dear {{Parent Name}},
    {{Student}}'s report card for Term 1 is attached.
    Parent meetings are on December 9 and 10. Reply to this email to book a time.
    Grace Lin
    School Office, Maple Ridge School
  4. Click Send Test Email and send the email to yourself. The test uses row 2, so you should get Daniel’s letter with 10482.pdf. Open the PDF and check the name on the report card.

  5. Check the other rows before you send. Do a dry run with drafts to create a Gmail draft for every row without emailing anyone.

  6. Go to the Save & Run step and click Send Emails.

The Mail Merge Status column shows Email sent for each row. If Mail Merge can’t find a row’s file, Mail Merge doesn’t send that email and writes Invalid attachment in the status cell. No parent gets the letter without the report card.

Upload the Term 2 PDFs to a Term 2 folder with the same grade folders. Then change Term 1 to Term 2 in the formula and fill the formula down again. Select the Mail Merge Status column below the title and press Delete, so Mail Merge sends to every row again.

Change the parts in quotes to match the way your files are named:

Your files are named Formula for F2 Output for Daniel
10482.pdf, all in one folder ="Report Cards/" & D2 & ".pdf" Report Cards/10482.pdf
Daniel Okafor.pdf ="Report Cards/" & C2 & ".pdf" Report Cards/Daniel Okafor.pdf
10482 Daniel Okafor.pdf ="Report Cards/" & D2 & " " & C2 & ".pdf" Report Cards/10482 Daniel Okafor.pdf
Report Card - 10482 - Term 1.pdf ="Report Card - " & D2 & " - Term 1.pdf" Report Card - 10482 - Term 1.pdf
A report card and a fee statement ="Report Cards/" & D2 & ".pdf, Fees/" & D2 & ".pdf" Report Cards/10482.pdf, Fees/10482.pdf

A comma separates two files in one cell, so the last formula attaches both PDFs.

To attach the same file to every email as well, such as the school calendar, see how to attach the same file.

Skip the Formula with an Embed File Marker

Section titled “Skip the Formula with an Embed File Marker”

You can build the same path in the message, without a column in the sheet. Type an Embed File marker on a line of its own at the end of the letter:

{{Embed File, Report Cards/Term 1/Grade {{Grade}}/{{Student ID}}.pdf}}

Mail Merge fills in the grade and the student ID for each row, attaches the file and removes the marker from the email. See how to attach files with the Embed File marker.

  • The name must match the file in Drive exactly. Check the spaces, the capital letters and the .pdf extension.
  • A sorted sheet stays correct. The formula reads the student ID in its own row, so each parent’s row always points to that child’s file.
  • A row with an empty File Attachments cell still gets the letter, without a PDF. To hold a student back, type SKIP in the row’s Mail Merge Status cell.
  • A file name can’t have a comma or a slash. Mail Merge reads a comma as the start of a second file and a slash as a folder. Rename a file such as Okafor, Daniel.pdf in Drive.
  • Mail Merge looks up names in My Drive and in files shared with you, not in shared drives. Keep the report cards in My Drive.
  • To write to both parents, add a CC column with the second parent’s address. See how to add CC and BCC recipients.
  • Gmail limits how many emails you send in a day. With 420 rows, check your email quota first. If the quota runs out, run the campaign again the next day, and Mail Merge sends only the rows that are left.

The status column shows “Invalid attachment”

Section titled “The status column shows “Invalid attachment””

Mail Merge couldn’t find a file with the name in that row. Copy the path from the File Attachments cell and compare it with the folder and file names in Drive. Fix the file name or the formula, then clear that row’s status cell and run the campaign again. See how to fix attachment errors.

The parent got another student’s report card

Section titled “The parent got another student’s report card”

Two files in your Drive have the same name, such as last year’s 10482.pdf. Add the folder path in front of the file name, so the path points to one file.