-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetPost.html
More file actions
82 lines (75 loc) · 2.55 KB
/
GetPost.html
File metadata and controls
82 lines (75 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html>
<head>
<title>Spreadsheet Status Update</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
}
#statusForm {
max-width: 300px;
margin: auto;
background: #f4f4f4;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
input[type=checkbox] {
margin-bottom: 20px;
}
input[type=button] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
background-color: deepskyblue;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
box-shadow: 0 3px 6px rgba(0,0,0,0.16);
transition: background-color 0.3s ease;
}
input[type=button]:hover {
background-color: #00bfff;
}
</style>
</head>
<body>
<form id="statusForm">
<label>
<input type="checkbox" id="cellStatus" name="cellStatus"> Cell Status
</label><br>
<input type="hidden" id="action" name="action" value="update">
<input type="button" value="Update Status" onclick="updateStatus()">
<input type="button" value="Get Status" onclick="getStatus()">
</form>
<script>
function updateStatus() {
var status = document.getElementById('cellStatus').checked; // true or false
var range = 'E221'; // Adjust based on your requirements
// Send POST request to Google Apps Script
fetch('YOUR_WEB_APP_URL', {
method: 'POST',
mode: 'no-cors', // Depending on Apps Script settings
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `action=update&range=${range}&value=${status}`
})
.then(response => response.json())
.then(data => {
console.log('Update Success:', data);
alert(`Update successful. Current status: All True: ${data.statuses.allTrue}, All False: ${data.statuses.allFalse}`);
})
.catch(error => {
console.error('Error:', error);
});
}
function getStatus() {
// Implement the functionality to get the status
// This function would likely make a GET or POST request similar to updateStatus but for retrieving data only.
}
</script>
</body>
</html>