If you’re in the business world, you’ve probably had to make labels for your products before. But did you know that you can easily generate and print labels right from Google Sheets? It’s a simple process that can save you tons of time and effort. In this blog post, we’ll walk you through the steps on how to print labels from Google Sheets.
Preparing Your Data
Before you can print labels, you need to ensure your data is properly formatted in Google Sheets. You’ll need a separate column for each piece of information you want on your labels. For instance, if you’re creating mailing labels, you might have columns for name, street address, city, state, and postal code.
Creating a Google Docs Template
Once your data is ready in Google Sheets, the next step is to create a template in Google Docs. This is where you’ll design how your labels will look. Go to Google Docs and create a new document. Then, head to the “Table” menu, select “Insert Table”, and choose the appropriate number of rows and columns for your labels.
In the table cells, type “<<Field Name>>“, replacing “Field Name” with the name of your column in Google Sheets. For example, if you have a column named “Name”, you would type “<<Name>>“. Repeat this for all the fields you want in your labels.
Merging Your Data
The next step is to combine your Google Sheets data with your Google Docs template. To do this, you’ll need a Google Docs add-on called “Avery Label Merge“. Go to “Add-ons” in the Google Docs menu, then “Get add-ons”, and search for “Avery Label Merge”. Install it, then run “Add-ons > Avery Label Merge > New Merge“.
Choose the Google Sheets document that contains your label data. Then, match your field names from Google Sheets with the fields in your Google Docs template. Once everything is matched up, click on “Merge” to create your labels.
Printing Your Labels
After merging, you should see a new Google Docs document with your completed labels. To print your labels, simply go to the “File” menu, select “Print”, and follow the prompts to print your labels.
function printGoogleDoc() {
var documentId = ‘DOCUMENT_ID_HERE’;
var url = ‘https://www.googleapis.com/auth/drive/v2/files/’ + documentId + ‘?fields=exportLinks’;
var token = ScriptApp.getOAuthToken();
var response = UrlFetchApp.fetch(url, {
headers: {
‘Authorization’: ‘Bearer ‘ + token
}
});
var json = JSON.parse(response.getContentText());
var pdf = UrlFetchApp.fetch(json.exportLinks[‘application/pdf’]).getBlob();
var printerId = ‘YOUR_PRINTER_ID’;
var title = ‘YOUR_DOCUMENT_TITLE’;
var ticket = {
version: ‘1.0’,
print: {}
};
var content = Utilities.base64Encode(pdf.getBytes());
var request = {
title: title,
contentType: ‘application/pdf’,
content: content,
ticket: JSON.stringify(ticket)
};
var response = UrlFetchApp.fetch(‘https://www.google.com/cloudprint/submit?printerid=’ + printerId + ‘&xsrf=’,
{
method: ‘POST’,
headers: {
‘Authorization’: ‘Bearer ‘ + token,
‘GData-Version’: ‘2.0’
},
payload: request
}
);
Logger.log(response);
}
With these steps, you can quickly and easily print labels from Google Sheets. No more manual labor or expensive software necessary. Happy labeling!