I’m trying to figure out how to pass custom data from a Google Form to Zapier. Right now, I’ve got a form set up that creates a folder in Google Drive when submitted. The form works with Zapier, but I want to send the new folder’s location to Zapier as a variable for the next steps in my workflow.
Here’s a simplified version of my current Google Apps script:
function handleFormSubmission() {
const mainFolder = DriveApp.getFolderById('MAIN_FOLDER_ID');
const formResponses = FormApp.getActiveForm().getResponses();
const latestResponse = formResponses[formResponses.length - 1];
const submitterName = latestResponse.getItemResponses()[0].getResponse();
const newFolder = mainFolder.createFolder(submitterName);
const timestamp = new Date().toISOString();
const subFolder = newFolder.createFolder(timestamp);
// Move uploaded files to the new subfolder
// ... (code omitted for brevity)
}
Is there a way to send the URL of the newly created folder to Zapier? I was thinking something like this might work, but I’m not sure:
return {customFolderUrl: subFolder.getUrl()};
Any help would be appreciated!
As someone who’s worked extensively with Google Forms and Zapier, I can share a method that’s worked well for me in similar situations. Instead of trying to directly pass variables to Zapier, which isn’t natively supported, you can leverage Google Sheets as an intermediary.
Here’s what I’ve done:
- Set up your Google Form to send responses to a Google Sheet.
- Modify your Apps Script to write the new folder URL to a specific cell in that sheet.
- Use Zapier to watch for new rows in the Google Sheet instead of form submissions.
This approach allows you to include any custom data you need, not just the folder URL. It’s more flexible and easier to maintain in the long run. Plus, you get the added benefit of having all your form data and custom variables in one place for easy reference.
Just remember to clear out old data from the sheet periodically to keep things running smoothly. Hope this helps!
I’ve encountered a similar challenge when integrating Google Forms with Zapier workflows. Unfortunately, Google Forms doesn’t natively support passing custom variables to Zapier. However, there’s a workaround you can use.
Instead of trying to return the folder URL directly, you can add a hidden field to your form that gets populated with the new folder’s URL. Here’s how you can modify your script:
- Add a hidden question to your form (e.g., ‘Folder URL’).
- In your script, after creating the subfolder, update the form response with the new URL:
const folderUrlItem = latestResponse.getItemResponses().find(item => item.getItem().getTitle() === 'Folder URL');
if (folderUrlItem) {
folderUrlItem.withResponse(subFolder.getUrl());
latestResponse.submit();
}
This way, when Zapier processes the form submission, it will have access to the folder URL as a regular form field. You can then use this field in subsequent steps of your Zap.
hey markseeker91, i’ve got a trick for ya. instead of messin with the form directly, why not use a google sheet as a middleman?
set up ur form to send responses to a sheet, then have ur script write the folder URL to a specific cell. zapier can watch for new rows in the sheet instead.
this way u can add any custom data u want. it’s pretty slick & flexible. good luck!