グーグルスプレッドシートで指定のセルをクリックしたら'DatePicker(カレンダー)'を表示してカレンダーで選択した日付をセルに入力したいんですが、可能でしょうか?
コード.gs
var app = SpreadsheetApp; function onOpen(e){ showContentApp(); } function showContentApp(){ var html = HtmlService.createHtmlOutputFromFile('DatePicker').setTitle('Date Picker').setWidth(320).setHeight(320); app.getActiveSpreadsheet().show(html); } function setRangeValue(arg){ app.getActiveRange().setValue(arg); }
DatePicker.html
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css"> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/dot-luv/jquery-ui.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-ja.min.js"></script> <script> $(function(){ $("#datepicker").datepicker({ onSelect: function(dateText, inst) { google.script.run.setRangeValue(dateText); } }); }); </script> <div id="datepicker"></div>
ただいまの現状としては、
①セルの選択ができない!
②シートを開いた(再読み込み)時点でポップアップが表示され、日付を選択しても入力されない
です。
皆様の御助力お願いいたします!
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。