this image is of my bootstrap modal from modal I wanna to get feedback of visitors I had hosted this portfolio in HTML I need to get feedback without any database using google sheet.
Asked
Active
Viewed 43 times
1 Answers
0
To give a general answer to your general question:
- If you are using a custom HTML form allowing the users to input their feedback, you can incorporate this HTML form into a Google Web App
- You can implement a JS script function that will retreive the input values on Form submit client side +You can call within the JS function a server-side Apps Script function with parameters with google.script.run
- Within the Apps script function you can write the input values as desired into a spreadsheet.
Sample:
HTML file index.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<form id="test-form">
<div>
<label>Field 1</label>
<input type="text" name="field_1" placeholder="Field 1" />
</div>
<div>
<label>Field 2</label>
<input type="text" name="field_2" placeholder="Field 2" />
</div>
<button type="submit" id="submit-form" onclick="myJSFunction()">Submit</button>
</div>
</form>
<script>
function myJSFunction(){
var data=[];
data.push(document.getElementsByName("field_1")[0].value);
data.push(document.getElementsByName("field_2")[0].value);
google.script.run.handleResponse(data);
}
</script>
</body>
</html>
.gs file
function doGet(e){
return HtmlService.createHtmlOutputFromFile('index');
}
function handleResponse(data) {
var sheet = SpreadsheetApp.openById('YOUR SPREADSHEET ID').getSheetByName(SHEETNAME);
sheet.getRange('A1').setValue(data[0]);
sheet.getRange('B1').setValue(data[1]);
}

ziganotschka
- 25,866
- 2
- 16
- 33