Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save user52839307/ccd5462494cb84b9e3fa13e18dd843df to your computer and use it in GitHub Desktop.
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 …
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