Last active
March 12, 2024 15:31
-
-
Save user52839307/ccd5462494cb84b9e3fa13e18dd843df to your computer and use it in GitHub Desktop.
Here's a basic example of how you could create a script to generate a Google Form from a Google Sheets document: 1. Open the Script Editor: In your Google Sheets, go to Extensions > Apps Script. 2. Replace the Code: Delete any code in the script editor and replace it with a custom script that reads the column headers from your sheet and creates …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createFormFromSheet() { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); | |
var range = sheet.getDataRange(); | |
var values = range.getValues(); | |
var headers = values[0]; // Assumes the first row contains headers | |
var form = FormApp.create('New Form from Sheet'); // Creates a new form | |
headers.forEach(function(header) { | |
form.addTextItem().setTitle(header); | |
}); | |
Logger.log('Form created: ' + form.getEditUrl()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment