- Home
- Guides
- Google Workspace
- How to generate PDF invoices from Google Sheets and email them automatically
How to generate PDF invoices from Google Sheets and email them automatically
Build a no-code automation that reads sales rows from Google Sheets, fills a Google Docs invoice template for each customer, converts it to PDF, emails it through Gmail and saves a copy in Google Drive.
Jump to a step (13)
Small businesses that track sales in a spreadsheet often create each invoice by hand: copy the customer details into a template, export a PDF, attach it to an email and send it. With ten or more customers a month that is an hour of repetitive work and an easy place to make mistakes.
The automation runs in UiPath Studio Web, which works in the browser and is free to start. It loops through every row in your Google Sheet, makes a copy of your Google Docs invoice template, replaces the placeholders with that row's data, downloads the copy as a PDF, and attaches it to a personalized Gmail message.
You can also skip the email and just generate the PDFs into a Google Drive folder. The same idea works with Excel Online and Outlook if your business runs on Microsoft 365.
What you need
- A Google account with Google Sheets, Google Docs, Google Drive and Gmail
- A free UiPath Studio Web account
- A Google Sheet of sales data with columns such as Customer Name, Customer Email, service and price columns, Invoice Number, Invoice Date, Due Date and Total
- An invoice template in Google Docs with placeholders in double curly brackets, such as
{{Customer Name}}
Step by step
0 of 13 done-
01
Prepare the sales data in Google Sheets
Put one customer per row. The sheet in the video has the customer name, email, service names and prices (some left blank), an invoice number, invoice date, due date and a total column. Your data can be in a different layout. You only need a column for every value that should appear on the invoice.
-
02
Create the invoice template in Google Docs
Design the invoice however you like in Google Docs. Wherever a value from the sheet should appear, type a placeholder inside double curly brackets, for example
{{Invoice Number}},{{Invoice Date}}and{{Customer Name}}. Use a table for the services and prices.Keep each placeholder name the same as its column name in the sheet. That makes the mapping step later much easier. The curly brackets are the marker the automation uses to find each field.
-
03
Sign up for UiPath Studio Web
Search for UiPath Studio Web and select
Try Studio Web. Sign up with your Google account, then create an organization by entering a display name, country and state and an organization name. Nothing needs to be installed on your computer. -
04
Create a new project
Open the
Automationstab and create a new project. Pick the manual trigger, because you will run this automation only when you need to send invoices. Rename the project, for exampleSend PDF invoices from Google Sheets. -
05
Read the Google Sheet rows in a loop
Select the plus icon, search for
Google Sheetsand addFor Each Row in Spreadsheetfrom Google Workspace. SelectConnect to Google Sheets, choose your account and allow access.Pick the spreadsheet (in the video,
Sales DataunderMy Drive). In the range box type the sheet name, an exclamation mark and the cell range, for exampleSheet1!A1:K11. The activity checks that the range is valid. LeaveHas headersset toTrue.Every activity from here on goes inside this loop, so it runs once per row.
-
06
Copy the template for each customer
Inside the loop, add
Copy Fileand connect Google Drive. For the file, browseMy Driveand select your invoice template. For the destination, create a folder such asInvoicesand select it.In the
New namebox, selectCustomer NamefromFor Each Row in Spreadsheet. Each copy is then named after the customer. -
07
Fill the template with the row's data
Add
Fill Document Templatefrom Google Workspace and connect Google Docs. For the document, open the options menu, chooseUse variableand pick the copied file from theCopy Fileactivity.Under the document fields, select
Addfor each placeholder. The key must match the placeholder text in the template exactly, for exampleCustomer Name. For the value, pressCtrl+Spaceand pick the matching column fromFor Each Row in Spreadsheet. Repeat for invoice number, customer email, services, prices, dates and total. Keeping the keys in a text file and pasting them avoids typos.Under
Show additional propertiesyou can see the placeholder symbol. It must match the brackets you used in the template. -
08
Convert the filled invoice to PDF
Add
Download Filefrom Google Workspace. For the file, chooseUse variableand pick the copied file again. Because the fill step already ran, this file now contains the customer's data.Under the additional properties, set the Google Docs download format to
PDF. The file is downloaded into the automation for the next step, not to your computer. PDF means the customer cannot edit the invoice. -
09
Email the PDF invoice with Gmail
Add
Send Emailfor Google Workspace and connect Gmail. SetToto theCustomer Emailcolumn from the loop. You can add a fixed CC address with theOpen expression editoroption if you need one.Type or paste a subject and replace its placeholders with the
Invoice NumberandDue Datecolumns. Paste your email text into the body and insertCustomer Name,Invoice Number,TotalandDue Datefrom the loop. You can bold the total and due date.Under
Attachments, select the file variable fromDownload File. Other providers such as Outlook are also available if you do not use Gmail. -
10
Save a copy of each PDF in Google Drive
Add
Upload Filesfrom Google Workspace. For the file, select the downloaded file variable. For the folder, create and select a folder such asPDF Invoices.If you only want to generate invoices without emailing them, keep this activity and delete
Send Email. -
11
Test the automation and switch off drafts
Select
Test. UiPath builds the project and runs the activities row by row. Check thePDF Invoicesfolder and your Gmail.On the first run in the video the emails landed in
Drafts, notSent. That is becauseSend Emailsaves as a draft by default. Set the draft option toFalse, delete the drafts and run again. The second run sends ten emails with ten different PDF invoices. -
12
Publish the automation and run it later
When testing is done, select
Publishand confirm. Next time, open theOrchestratormenu in the UiPath dashboard, go to theAutomationstab, select the process and chooseStart a job. -
13
Clean up the working copies
The
Invoicesfolder holds the filled Google Docs copies the automation made along the way. You can delete them once the run is complete. The final PDFs stay in thePDF Invoicesfolder.
Tips and common problems
Send Emailsaves messages as drafts by default. Set the draft option toFalseif you want the invoices sent immediately.- The keys in
Fill Document Templatemust match the placeholders in the Google Docs template exactly, including the symbol. One typo leaves that placeholder unfilled. - Add every activity inside the
For Each Row in Spreadsheetloop, not below it, or it will not run for each customer. - Set the sheet range to cover your data. Extra blank rows in the range are fine because the automation skips them.
- Delete the Google Docs copies in the working folder after each run so old invoices do not pile up next to the PDFs.
Prefer Microsoft 365?
If you work in Excel and Outlook, see the mail merge with individual attachments tutorial built with Power Automate: watch it here.
Questions
How do I create PDF invoices from Google Sheets automatically?
Make a Google Docs invoice template with placeholders, then use an automation (UiPath Studio Web in this video) that loops through each sheet row, copies and fills the template, and downloads it as a PDF.
Can I generate the PDF invoices without emailing them?
Yes. Remove the Send Email activity and keep Upload Files, which saves each PDF into a Google Drive folder.
Is UiPath Studio Web free?
The video uses a free UiPath Studio Web account. It runs in the browser, so there is nothing to install.
Does this work with Excel and Outlook instead of Google Sheets and Gmail?
Yes. The video notes that the same process works with Excel Online and Microsoft Outlook. You swap the Google activities for their Microsoft equivalents.
