I have created a Google form, and I need to create a new sheet in an existing spreadsheet for each response I receive from this form - each respondent generates a new sheet within the spreadsheet. Is this possible with some kind of onSubmit command? I'm completely new to Javascript but willing to learn. Thanks so much for your help.
相关问题
- How can I force all files in a folder to be owned
- Google Apps Script: testing doPost() with cURL
- Google Apps Script to turn in, grade, and return a
- Script fails on SpreadsheetApp.openById - Requires
- Split Lines and Bold Text within a ui.alert Window
相关文章
- How to allow access for importrange function via a
- Google app script trigger not working
- Set Date/Time to 00:00:00
- indexOf returning -1 despite object being in the a
- Using MIN() inside ARRAYFORMULA()
- How can my Google Apps Script be run by others the
- Google Spreadsheet COUNTIF formula equivalent with
- In Google Sheets how to reference infinite rows in
For this you can get the Spreadsheet using this command(getActiveSpreadsheet()) and then create a new sheet based on the parameters you require from this page. you can add this lines of code in your
onSubmit
trigger.Hope that helps!
You can't intercept a Google Form submission before the data is written into the spreadsheet. All you can do is manipulate the data after it's already been inserted into the spreadsheet. So, your responses will get put into the spreadsheet, all in one sheet to start with. You can't change that.
Now the question is, do you want to manipulate the data from code bound to the form or bound to the sheet? You'll want to use a project bound to the sheet.
This is some sample code:
This code assumes that the value you want to name your sheet is in column A function subTheForm() { Logger.log('submit ran');
Old answer:
You'll need to generate some kind of unique string every time a new form is submitted. I have no idea what you want. You could get the user name, then add the date/time to it, then name each new sheet the user name with the time. The basic code will look like this:
Note the
Logger.log();
statement. That prints something to the LOG. Inside the code editor, you can select the VIEW menu, and the LOGS menu item to show the LOG.You can also run the code "manually" from the code editor by selecting the function name and clicking the run arrow icon. That way you can run the code without submitting a form every time. Get the code to work, then wire it up to the onsubmit trigger.