As an AI language model, I can provide you a sample HTML form that uses Bootstrap and JavaScript to update a dropdown list from another Google Sheet using Google Apps Script. Here is the sample code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Google Forms</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap stylesheet -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h3>Google Form</h3>
<form id="myForm">
<div class="form-group">
<label for="input1">Input 1</label>
<input type="text" class="form-control" id="input1" name="input1">
</div>
<div class="form-group">
<label for="input2">Input 2</label>
<input type="text" class="form-control" id="input2" name="input2">
</div>
<div class="form-group">
<label for="input3">Input 3</label>
<input type="text" class="form-control" id="input3" name="input3">
</div>
<div class="form-group">
<label for="input4">Input 4</label>
<input type="text" class="form-control" id="input4" name="input4">
</div>
<div class="form-group">
<label for="input5">Input 5</label>
<input type="text" class="form-control" id="input5" name="input5">
</div>
<div class="form-group">
<label for="select1">Select 1</label>
<select class="form-control" id="select1" name="select1">
<option value="">Select an option</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<!-- Bootstrap and jQuery scripts -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<!-- Google Apps Script -->
<script>
var form = $('#myForm');
form.submit(function(e) {
e.preventDefault();
var data = form.serializeArray();
google.script.run.addData(data);
form[0].reset();
$('#select1').empty();
$('#select1').append($('<option>', {
value: '',
text: 'Select an option'
}));
});
google.script.run.withSuccessHandler(updateSelect).getDropdownOptions();
function updateSelect(options) {
console.log(options);
$.each(options, function(index, value) {
$('#select1').append($('<option>', {
value: value,
text: value
}));
});
}
</script>
</body>
</html>
This code creates an HTML form with 5 input boxes and a dropdown list. When the form is submitted, it sends the data to a Google Apps Script function called "addData". The dropdown list is updated dynamically using a Google Apps Script function called "getDropdownOptions".
To create the Google Apps Script, open the Google Sheet where you want to store the form data, and go to "Tools" -> "Script editor". Then, copy and paste the following code:
function addData(data) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow([data[0].value, data[1].value, data[2].value, data[3].value, data[4].value]);
}
function getDropdownOptions() {
var sheet = SpreadsheetApp.openById("your-spreadsheet-ID").getSheetByName("Sheet1"); // Replace the spreadsheet ID and sheet name with your own ones
var data = sheet.getDataRange().getValues();
var options = [];
for (var i = 1; i < data.length; i++) {
var option = data[i][0];
if (options.indexOf(option) == -1) {
options.push(option);
}
}
return options;
}
Note that I assumed that you want to store the form data in the first sheet of the Google Sheet where you added the script, and that the dropdown options are on the first column of the first sheet of another Google Sheet with the ID "your-spreadsheet-ID". You will need to replace these values with your own ones.
I hope this helps you get started!