結果:ボタンをクリックしても、シートの指定された部分は変更されません
テスト済みコンテンツ:setVf()を使用して、シートの指定された部分に「a」を入力できます
html
1<head> 2 <script> 3 function buttonClick(){ 4 setVf("data",1,1,"a"); 5 } 6 function getRf(sheetname, row, column){ 7 const Gs = SpreadsheetApp.getActiveSpreadsheet(); 8 const Gss =Gs.getSheetByName(sheetname); 9 const GssRange = Gss.getRange(row,column); 10 return GssRange 11 } 12 function setVf(sheetname,row,column,test){ 13 getRf(sheetname,row,column).setValue(test); 14 } 15</script> 16</head> 17<body> 18 <button type="button" onclick= "buttonClick()">button</button> 19</body> 20</html>
##No.1: <script>と</ script>の間に原因があると予想されます。
html
1<script>function buttonClick(){console.log("a");}</script>
予想される動作 | 結果 |
---|---|
ボタンをクリックすると、「a」が表示されます。 | ボタンをクリックすると、「a」が表示されます。 |
##No.2: その他の試験と結果 | |
```html | |
<button type="button" onclick= <? buttonClick() ?>>button</button> | |
//test.html | |
``` |
script
1function doGet() { 2 const html = HtmlService.createTemplateFromFile("test"); 3 return html.evaluate() 4} 5function buttonClick() { 6 setVf("data",1,1,"n"); 7} 8function getRf(sheetname, row, column){ 9 const Gs = SpreadsheetApp.getActiveSpreadsheet(); 10 const Gss =Gs.getSheetByName(sheetname) 11 const GssRange = Gss.getRange(row,column); 12 return GssRange 13} 14function setVf(sheetname,row,column,text){ 15 getRf(sheetname,row,column).setValue(text); 16}
予想される動作 | 結果 |
---|---|
ボタンをクリックすると、目的の場所に「a」が表示されます。 | doGet()が実行されると、目的の場所に「a」が表示されます。 |
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。