HTMLサービスを使用したgoogle appsスクリプトでは、基本的なユーザー情報を取得し、データをMySQLデータベースにロードするカスタムWebページインターフェイスを作成する方法。あなたが開始する前に、私はよくthis documentを読んで、以下のコードgoogle appsスクリプトhtmlサービスWebページ
function getHtml() {
var ss = SpreadsheetApp.getActiveSpreadsheet(),
html = HtmlService.createHtmlOutputFromFile('index');
ss.show(html);
}
function getData(form){
var firstName = form.firstName,
lastName = form.lastName,
dob = form.dob,
email = form.email,
phone = form.phone,
sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.appendRow([firstName, lastName, dob, email, phone]);
}
//index.html
<!DOCTYPE html>
<html>
<b>Add Record</b><br />
<form>
First name: <input id="firstname" name="firstName" type="text" /> <br />
Last name: <input id="lastname" name="lastName" type="text" /> <br />
DOB: <input id="dob" name="dob" type="date" /> <br />
Email: <input id="email" name="email type="text" /> <br />
Phone: <input id="phone" name="phone" type="text" /> <br />
<input onclick="formSubmit()" type="button" value="Add Record" /> <br />
<input onclick="google.script.host.close()" type="button" value="Exit" />
</form>
<script type="text/javascript">
function formSubmit() {
google.script.run.getValuesFromForm(document.forms[0]);
}
</script>
</html>
はエラーがありますか?それとも問題? –
私は問題があります。私はmysqlテーブルにレコードを追加する方法を知らない。 – user25407