const QUIZ_FOLDER_ID = 'YOUR_FOLDER_ID'
function myFunction() {
addFormItems()
}
function addFormItems() {
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
// Copy this script into the feedback spreadsheet TEMPLATE | |
/************************ OnOpen *******************************/ | |
function onOpen(e) { | |
var ui = SpreadsheetApp.getUi().createMenu("Shortlink") | |
.addItem("Show URL and QR code", "showQrAndLink") | |
.addToUi() | |
} | |
/************************ GLOBALS *******************************/ |
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
/* script example to retrieve question IDs from form questions, useful for building pre-filled URLs for form entry. | |
* Copyright 2015, James Petersen | |
* Published under a Creative Commons Attribution - NonCommercial ShareAlike 4.0 International Licence | |
*/ | |
function getFormQuestions() { | |
var form = FormApp.openById(REF_FORM_ID); | |
var items = form.getItems(); | |
var currentItem; | |
var validationRules = []; | |
var questionHeaders = [[],[],[],[]]; |
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
var RESPONSE_SPREADSHEET_ID = <ID of Form Generator response spreadsheet>; | |
var FORMS_FOLDER_ID = <folder ID to put generated forms>; | |
var TARGET_LINK_COLUMN = <column number to put generated form link>; | |
var RESPONSE_LINK_COLUMN = <column number to put generated form response link>; | |
function doTest() { | |
SpreadsheetApp.setActiveSpreadsheet(SpreadsheetApp.openById(RESPONSE_SPREADSHEET_ID)); | |
SpreadsheetApp.getActiveSheet().getRange(2,TARGET_LINK_COLUMN,1,1).setValue('Hello there'); | |
} |
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 rosterMaker() { | |
//spreadsheet id of the rosters | |
var SHEET_ID = FormApp.getActiveForm().getDestinationId(); | |
var ss = SpreadsheetApp.openById(SHEET_ID); | |
var form = FormApp.getActiveForm(); | |
//get only the sheets with 'Roster' in the title | |
var sheets = ss.getSheets() | |
.filter(function(sheet) {return sheet.getName().match(/Roster/gi);}); | |
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 setReferees() { | |
Logger.log("Starting function"); | |
var ssID = "xxxxx"; | |
var formID = "xxxxx"; | |
var wsData = SpreadsheetApp.openById(ssID).getSheetByName("data"); | |
var refData = wsData.getRange(2, 1, wsData.getMaxRows() - 1).getValues(); | |
var form = FormApp.openById(formID); |
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
var ID_FORM_ABSENSI = "YOUR-FORM-ID"; | |
var SHEET_DAFTAR_NAMA_MURID = "THE-NAME-OF-SHEET-CONTAINING-THE-DATA"; | |
function populateNamesDropdown() { | |
// call your form and connect to the drop-down item | |
var form = FormApp.openById(ID_FORM_ABSENSI); | |
// get first dropdown item | |
var fieldNames = form.getItems(FormApp.ItemType.LIST)[0].asListItem(); |
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 githubPost() { | |
var ss = SpreadsheetApp.openById(ssID) // replace the ssID with the Spreadsheet ID | |
var sheet = ss.getSheetByName("Form Responses 1"); | |
var formResponses = FormApp.getActiveForm().getResponses(); | |
var res = formResponses[formResponses.length-1].getItemResponses(); | |
var amt = res[0].getResponse(); | |
var title = "Load Schedule 70 data into CALC. >>> Current bid: " + amt + " <<<" | |
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
var rnSid = "1IYVDeHENOXV1oFaKrZJKZRImEYsrCQptadWMV4rlzj8"; | |
var rmFid = "1Lq2mtWjlFoGu0STU7MuiI6-F1eXRD1HmkRzpe30P__g"; | |
var wsRestaurantMenu = SpreadsheetApp.openById(rnSid).getSheetByName("restaurantMenu"); | |
var form = FormApp.openById(rmFid); | |
function main(){ | |
var lavels = wsRestaurantMenu.getRange(1, 1,1,wsRestaurantMenu.getLastColumn()).getValues()[0]; |
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
/* GScript for adding edit urls to the response sheet. Needs to be run after every submit/form edit */ | |
function assignEditUrls() { | |
var form = FormApp.openById('FORM_ID'); | |
var sheet = SpreadsheetApp.openById('SPREADSHEET_ID').getSheetByName('SPREADSHEET_NAME'); | |
var data = sheet.getDataRange().getValues(); | |
var urlCol = 7; //COLUMN NUMBER | |
var responses = form.getResponses(); | |
var timestamps = [], urls = [], resultUrls = []; | |
for (var i = 0; i < responses.length; i++) { |
OlderNewer