gasで即席でつくってみた。値を選択式にすると、もう少し使いやすかも。
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script src="https://code.jquery.com/jquery-3.6.1.slim.min.js" integrity="sha256-w8CvhFs7iHNVUtnSP0YKEg00p9Ih13rlL9zGqvLdePA=" crossorigin="anonymous">
</script>
</head>
<body>
<div style="font-size:large;">
<input type="text" id="hiduke" value="" style="font-size:large;">
<input type="text" id="jikoku" value="" style="font-size:large;">
<br>High
<input type="text" id="high" value="" style="font-size:large;"><br>
Low
<input type="text" id="low" value="" style="font-size:large;"><br>
脈
<input type="text" id="myaku" value="" style="font-size:large;">
<button id='Enter' onclick="Enter()">保存</button>
<div id="msg"></div>
</div>
<div><a href="https://docs.google.com/spreadsheets/d/シートID/edit#gid=0">シート</a></div>
</body>
</html>
<script>
window.onload = function(){
let today=new Date();
$('#hiduke').val(formatDate_dateOnly(today));
$('#jikoku').val(formatDate_jikoku(today));
}
function formatDate_jikoku(dt) {
var y = dt.getFullYear();
var h=('00' + dt.getHours()).slice(-2);
var mi=('00' + dt.getMinutes()).slice(-2);
return (h+':'+mi);
}
function formatDate_dateOnly(dt) {
var y = dt.getFullYear();
var m = ('00' + (dt.getMonth()+1)).slice(-2);
var d = ('00' + dt.getDate()).slice(-2);
return (y + '/' + m + '/' + d);
}
function Enter() {
let hiduke =$('#hiduke').val();
let jikoku =$('#jikoku').val();
let high =$('#high').val();
let low =$('#low').val();
let myaku =$('#myaku').val();
google.script.run.withSuccessHandler(onSuccess).withFailureHandler(onFailure).Set(hiduke,jikoku,high,low,myaku);
}
function onSuccess(res){
$('#msg').text(res);
}
function onFailure(res){
$('#msg').text(res);
}
</script>
<html>
<head>
<base target="_top">
<script src="https://code.jquery.com/jquery-3.6.1.slim.min.js" integrity="sha256-w8CvhFs7iHNVUtnSP0YKEg00p9Ih13rlL9zGqvLdePA=" crossorigin="anonymous">
</script>
</head>
<body>
<div style="font-size:large;">
<input type="text" id="hiduke" value="" style="font-size:large;">
<input type="text" id="jikoku" value="" style="font-size:large;">
<br>High
<input type="text" id="high" value="" style="font-size:large;"><br>
Low
<input type="text" id="low" value="" style="font-size:large;"><br>
脈
<input type="text" id="myaku" value="" style="font-size:large;">
<button id='Enter' onclick="Enter()">保存</button>
<div id="msg"></div>
</div>
<div><a href="https://docs.google.com/spreadsheets/d/シートID/edit#gid=0">シート</a></div>
</body>
</html>
<script>
window.onload = function(){
let today=new Date();
$('#hiduke').val(formatDate_dateOnly(today));
$('#jikoku').val(formatDate_jikoku(today));
}
function formatDate_jikoku(dt) {
var y = dt.getFullYear();
var h=('00' + dt.getHours()).slice(-2);
var mi=('00' + dt.getMinutes()).slice(-2);
return (h+':'+mi);
}
function formatDate_dateOnly(dt) {
var y = dt.getFullYear();
var m = ('00' + (dt.getMonth()+1)).slice(-2);
var d = ('00' + dt.getDate()).slice(-2);
return (y + '/' + m + '/' + d);
}
function Enter() {
let hiduke =$('#hiduke').val();
let jikoku =$('#jikoku').val();
let high =$('#high').val();
let low =$('#low').val();
let myaku =$('#myaku').val();
google.script.run.withSuccessHandler(onSuccess).withFailureHandler(onFailure).Set(hiduke,jikoku,high,low,myaku);
}
function onSuccess(res){
$('#msg').text(res);
}
function onFailure(res){
$('#msg').text(res);
}
</script>
*****************
function doGet(e) {
return HtmlService.createTemplateFromFile("index").evaluate();
}
function Set(hiduke,jikoku,high,low,myaku) {
let spreadSheet = SpreadsheetApp.openById(シ-トID);
let sheet = spreadSheet.getSheetByName('シート1');
let lastrow = sheet.getLastRow();
sheet.getRange(lastrow+1, 1).setValue(hiduke);
sheet.getRange(lastrow+1, 2).setValue(jikoku);
sheet.getRange(lastrow+1, 3).setValue(high);
sheet.getRange(lastrow+1, 4).setValue(low);
sheet.getRange(lastrow+1, 5).setValue(myaku);
return "送信済み"
}
0 件のコメント:
コメントを投稿