在Google Sheets中使用Bootstrap DateTime选择器和自定义HTML表单,您可以按照以下步骤进行操作:
<input type="text" id="datetimepicker" class="form-control">
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [
{name: "选择日期时间", functionName: "showDateTimePicker"}
];
sheet.addMenu("自定义表单", menuEntries);
}
function showDateTimePicker() {
var htmlOutput = HtmlService.createHtmlOutputFromFile('datetimepicker')
.setWidth(300)
.setHeight(200);
SpreadsheetApp.getUi().showModalDialog(htmlOutput, '选择日期时间');
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="input-group date" id="datetimepicker">
<input type="text" class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</div>
<script>
$(function() {
$('#datetimepicker').datetimepicker();
});
</script>
</body>
</html>
这样,您就可以在Google Sheets中使用Bootstrap DateTime选择器和自定义HTML表单了。请注意,这只是一种实现方式,您可以根据自己的需求进行修改和调整。
领取专属 10元无门槛券
手把手带您无忧上云