Google sheets mail merge labels
A classic use case!
Google Sheets can be used to create a mail merge template for printing labels. Here's a step-by-step guide to help you get started:
Prerequisites:
- You have a Google Sheets document with a list of data you want to use for the mail merge.
- You have a label template designed in a program like Microsoft Word or Adobe Illustrator.
Step 1: Prepare your data
In your Google Sheets document, create a table with the following columns:
- Column A: Name (or any other field you want to use for the label)
- Column B: Address (or any other field you want to use for the label) *... (add more columns as needed)
Make sure to format the data correctly, using the same format as your label template.
Step 2: Create a mail merge template
Open your label template in a program like Microsoft Word or Adobe Illustrator. Create a new document with the following settings:
- Page size: Match the size of your label
- Orientation: Portrait or Landscape, depending on your label's orientation
- Margins: Set the margins to 0.1 inch (0.25 cm) or less to ensure the text fits within the label
Insert a table with the same number of columns as your Google Sheets data. In the table, create a header row with the column names (e.g., "Name", "Address", etc.).
Step 3: Link the data to the template
In your Google Sheets document, select the entire data range (A1:B100, for example). Go to the "Tools" menu and select "Script editor". This will open the Google Apps Script editor.
In the script editor, paste the following code:
function mailMerge() {
var sheet = SpreadsheetApp.getActiveSheet();
var dataRange = sheet.getDataRange();
var data = dataRange.getValues();
var template = DocumentApp.openById('your-template-id').getBody();
var table = template.getTables()[0];
for (var i = 0; i < data.length; i++) {
var row = data[i];
table.getRow(i + 1).getCell(1).setText(row[0]);
table.getRow(i + 1).getCell(2).setText(row[1]);
//... (add more cells as needed)
}
}
Replace 'your-template-id'
with the ID of your label template document.
Step 4: Run the script
Save the script and go back to your Google Sheets document. Click on the "Run" button or press Ctrl+Enter to execute the script.
The script will merge the data from your Google Sheets document with the label template. You should see the merged document in the script editor.
Step 5: Print the labels
Save the merged document as a PDF or print it directly from the script editor. You can also use a third-party add-on like "Print Label" to print the labels directly from Google Sheets.
That's it! With these steps, you should be able to create a mail merge template for printing labels using Google Sheets.