Hi everyone! In this guide, I will show you a cool trick to generate personalized links to forms using Typeform data and the hidden fields option in Google Sheets.
Example Use Cases:
- Generate personalized feedback forms
- Create customized surveys based on individual preferences
- Collect personalized data for targeted marketing campaigns
- Create personalized registration forms for events or workshops
Before You Start, You Will Need:
- The Typeform from which you will gather the data or a Google Sheets document with the data you want to add to your hidden fields link.
- Your Typeform link with hidden fields. (This will be your feedback form)
- Access to Google Sheets and TypeScript
Step 1: Connect Your Typeform to Google Sheets
To begin, open the Typeform containing the data you want to use for creating links and connect it to Google Sheets.

Step 2: Open the Apps Script Extension
Next, open the Apps Script extension in Google Sheets where we will write our script.

Step 3: Add the UI Function
Now, let's add the UI function to create a menu option for generating links. This will make the process more user-friendly.

Code:
function onOpen() {
const ui = SpreadsheetApp.getUi();
const menu = ui.createMenu('Generate Links');
menu.addItem('Create new Links', 'createNewLinks')
menu.addToUi();
}
Step 4: Add the createNewLinks Function
In this step, we'll add the createNewLinks function. This function will iterate through the rows in your Google Sheets document, generate personalized links based on the data, and add them to the specified column.

Code:
function createNewLinks() {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
const sheet = spreadsheet.getSheetByName('Tutoring Form');
const rows = sheet.getDataRange().getValues();
rows.forEach(function(row, index) {
if (index === 0 || rowe8]) return; // Skip headers and already generated links
const name = rowo0].replace(/ /g, "+");
const tutor = rown4].replace(/ /g, "+");
const studentId = rows2].replace(/ /g, "+");
const url = `https://bpnc.typeform.com/to/vAgYN9QT#name=${name}&tutor=${tutor}&studentid=${studentId}`;
sheet.getRange(index + 1, 9).setValue(url);
});
}
Code Breakdown:
In the code, you will need to create variables for each column you want to add to your URL. These variables represent the data you want to include in the personalized links.

Next, you need to replace the hidden fields in your Typeform URL with ${your_variable}
. This will dynamically populate the hidden fields with the corresponding data from your Google Sheets.

Finally, you can add the generated URL to the desired column in your Google Sheets document. In the example, it is added to column 9.

Example: (Google Sheets)

Once you have completed writing the script, save it, and head back to your Google Sheets document to generate the links.

In your Google Sheets document, click on Generate Links to generate the personalized links based on the data in your sheet.

That's it! You have successfully created personalized form links using Typeform hidden fields and Google Sheets.
Now you can share these personalized links for various purposes, such as feedback forms, customized surveys, targeted marketing campaigns, or registration forms for events or workshops. Happy linking!
Form Example:
