Create New Tab For Each Google Form Submission
Learn how to create a new tab for each Google Form submission using Apps Script, perfect for organizing data like employee onboarding. This tutorial covers creating a form, writing the script, and setting up triggers to automate the process.
We want to create a new tab for each Google Form submission. This is great for things like employee onboarding or any time where you're capturing a little bit of data and you want to enter it into a new tab. So when we create a form, very often that form, all of those submissions go into the exact same tab. But what we want to do is we want to make sure that our sheet has a tab for each of those submissions. Let's go up and create a form because that's the first step in this process. The second step is we're going to create a Apps Script that's going to actually do the thing we want, which is create a new tab. And then we're going to have to set it up with a trigger . So that's the three steps. We're going to create a form, create an Apps Script , and create a trigger . We have a new form here. Let's call it new employee.
And let's get full Name, and that might be our name of our new tab. We might have department you're in, we'll ask for multiple choice, we'll say you're in IT, finance, support, etc. We can ask any more types of questions if we want. Let's publish this to make sure that we can actually get responses. And as of right now, if we enter this, Andrew, Carl, submit, we're going to get all of our responses right here on a form responses one. So let's go to our script, extensions app script , and start creating a script that we're going to trigger . We're going to call it new tab. And we need an event or this variable E, we're going to call it.
And it's going to gather information when we create that trigger . We can get the full name this way because on our form it says full name here. So we get that by going e. named values and we put in full name. We want to make sure we get that so let's do logger. log full name. And as I said we need to create this Apps Script first and then we need to create the trigger . The trigger is over here on the left, triggers. Add trigger . We're going to choose which function to run. If you have multiple functions , if not, it'll be the only one. From spreadsheet, and select event type on form submit. Click save. Now everything is connected. The form is connected to the Apps Script, and we just need to make sure we have the correct Apps Script to create that new tab.
The first time you save this or run it, you're going to have to authorize it, but it'll only happen the first time. And now everything's connected. Let's enter Andrew Carl again. Submit. And we can go to our executions and see that we get our name here. So we're on the right track. We need to create a new tab. So we're going to use spreadsheet app dot get active spreadsheet . Insert sheet. Set name. Full name. Now we have a new sort of built in function here. So we should actually go back and go back to our triggers and probably delete this and run it again or add it again so that we get the new authorization . That may be an issue you have later on.
Submit another response. Reginald Roundtree, submit. And now we have a tab called Reginald Roundtree. There we go. We've created a new tab. Every single time we enter this form, this full name, getting a full name, and we're setting that name here. If you have some other permutation of what that name is, maybe you want to add full name plus the date. Plus date. Let's get variable date equals utilities dot format date, new date, time zone is just going to be GMT plus zero, let's say. And our format , let's say it's month, month, month, day, year, year, year. Save this. Oh, we need to end the parentheses. Save it.
Now we don't need to create the trigger again. The trigger is already done. We need a new employee. Frank Carroll, click submit, and we see Frank Carroll and our date. We can also add a space here if we want, plus a space, there we go, save it, new employee, let's create a new one, Francis Fran, hit submit, go back to our sheet, there's Francis Fran with a space and then the date. Pretty cool, right? We can create a new tab for each Google Sheet submission. Or Google Form Submission, sorry. If you're looking to get more automations into your sheets, do cool stuff, get more out of your sheets than you ever thought of, make your sheets sleep. Make your sheets work while you sleep. Subscribe today here on YouTube to BetterSheets.