Introduction
QR codes are an incredibly convenient way to share information, whether it’s a URL, an email address, or a phone number. With Google Sheets, you can create QR codes automatically whenever data is entered into the spreadsheet — and the best part? It’s completely free!
In this guide, we’ll walk you through how to set up a Google Sheet that generates QR codes automatically. Plus, we’ll show you how to adjust the row height to ensure your QR codes are visible and neatly displayed. This solution uses Google Apps Script and doesn’t require any paid tools. Let’s dive in!
Step 1: Set Up Your Google Sheet
First, you’ll need a Google Sheet with two columns:
- Column A: This is where you’ll enter the data (URLs, email addresses, phone numbers, etc.) for which QR codes will be generated.
- Column B: This is where the QR codes will automatically appear.
Make sure Column A is ready for data entry, and leave Column B empty for the QR codes to populate.

Step 2: Open Google Apps Script
To start creating the automation, you’ll need to use Google Apps Script:
- In your Google Sheet, click on Extensions > Apps Script.
- This will open a new tab where you can write custom scripts to automate tasks in your sheet.

Step 3: Write the Script
Now, let’s write the script that will generate the QR codes and adjust row heights automatically.
Here’s the script you need to use:
// Function to generate QR codes and adjust row height
function onEdit(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = e.range; // The edited range
var row = range.getRow();
var col = range.getColumn();
// Generate QR codes if Column A is edited (starting from row 2)
if (col == 1 && row >= 2) {
var input = e.value; // Get the value entered in Column A
var qrColumn = 2; // QR codes will go into Column B
// If input exists, generate the QR code
if (input) {
var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" + encodeURIComponent(input);
sheet.getRange(row, qrColumn).setFormula(`=IMAGE("${qrUrl}")`);
} else {
sheet.getRange(row, qrColumn).clearContent(); // Clear QR code if input is empty
}
}
// Adjust row height for rows starting from row 2
if (row >= 2) {
sheet.setRowHeight(row, 150); // Set height to 150 pixels
}
}
This script does two things:
- Generates QR codes in Column B when data is entered into Column A (starting from row 2).
- Adjusts the row height automatically for rows starting from row 2, ensuring that the QR codes are displayed clearly.
Step 4: Set Up Triggers for Automatic Execution
For the script to run automatically when you enter data into Column A, you need to set up a trigger.
- Go to the Apps Script editor.
- Click the Triggers icon (clock-shaped) on the left.
- Click + Add Trigger at the bottom-right.
- In the dropdowns, select:
- Function:
onEdit
- Event Type: On Edit
- Function:
- Click Save.

Step 5: Test the Script
Now that the trigger is set up, go back to your Google Sheet and enter some data in Column A (e.g., a URL, email address, or phone number). The QR code should automatically appear in Column B, and the row height will adjust to ensure the QR code is visible.
Test with different types of data to see how the script reacts. For example, entering https://www.example.com
should generate a QR code that links to that website.
Conclusion
Congratulations! You’ve successfully set up an automatic QR code generator in Google Sheets, all without spending a penny. Now you can easily generate QR codes for URLs, email addresses, phone numbers, or any other data you enter in your spreadsheet.
If you’ve followed the steps above, you should now have a seamless process for generating and displaying QR codes with auto-adjusted row heights. This simple and free solution is perfect for anyone who needs to work with QR codes frequently.
Feel free to customize and expand this script based on your needs. For example, you can change the QR code size, adjust the row height, or add other functionality like timestamping when the QR codes are created.
Now it’s your turn! Try this out and elevate your productivity in Google Sheets. Have any questions or ideas for improvement? Drop them in the comments below!
Additional Tips:
- Customization: You can adjust the QR code size by modifying the URL in the script. For example, change
size=150x150
to another value (e.g.,size=300x300
) to get larger or smaller QR codes. - Clear Data: If you want to clear the QR code when data is removed from Column A, the script already takes care of this by clearing the QR code when the input is empty.
Next Steps
- Check out more guides like this on www.funwithai.in.
- Share this post if you found it helpful!