Form gửi dữ liệu từ Website lên Google Sheet không dùng Google Forms





google.load(‘visualization’, ‘1’, {‘packages’:[‘corechart’]});
google.setOnLoadCallback(ValIDS);

function ValIDS() {
var queryValIDS = new google.visualization.Query(‘//docs.google.com/spreadsheet/ccc?key=1HpHMfoEnPgESb2XPVCgb7XyGwRAvrq3EoQj4WHj4vhA&sheet=QUERY2’);
queryValIDS.send(handleQueryValIDResponse);
}

function handleQueryValIDResponse(response) {
if (response.isError()) {
alert(‘Error in ID Validation Query: ‘ + response.getMessage() + ‘ ‘ + response.getDetailedMessage());
return;
}

var datatable = response.getDataTable();
for (var i = 0; i < datatable.getNumberOfColumns(); i++) { var ddItem = document.getElementById('myDropdown').appendChild(document.createElement('A')); ddItem.href = '#'; var ddItemContent = ddItem.appendChild(document.createElement('SPAN')); ddItemContent.id = 'cat' + (i + 1); ddItemContent.innerHTML = datatable.getValue(0, i); } } function myFunction() { document.getElementById('myDropdown').classList.toggle('show'); } window.onclick = function(event) { if (!event.target.matches('.dropbtn')) { var dropdowns = document.getElementsByClassName('dropdown-content'); var i; for (i = 0; i < dropdowns.length; i++) { var openDropdown = dropdowns[i]; if (openDropdown.classList.contains('show')) { openDropdown.classList.remove('show'); } } } }

.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}

.dropbtn:hover, .dropbtn:focus {
background-color: #3e8e41;
}

.dropdown {
position: relative;
display: inline-block;
}

.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}

.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}

.dropdown a:hover {background-color: #f1f1f1}

.show {display:block;}

.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;