実際のところ
Spread Sheetに
1,A,あ 2,B,い 3,C,う
上記ファイルのidが'1234567890abcdefghijklmnopqrstuvwxyz'であるとき、
code.gsは
function doGet() { var template = HtmlService.createTemplateFromFile('hello.html'); return template.evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME); } function getData() { var fileid = '1234567890abcdefghijklmnopqrstuvwxyz'; return SpreadsheetApp .openById(fileid) .getActiveSheet() .getDataRange() .getValues(); }
hello.html
<!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> <p>List of things:</p> <ul id="data"> <li>Loading...</li> </ul> </body> </html> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script> <script> // The code in this function runs when the page is loaded. $(function() { google.script.run.withSuccessHandler(showThings) .getData(); }); function showThings(things) { var list = $('#data'); list.empty(); for (var i = 0; i < things.length; i++) { list.append('<li>' + things[i][i] + '</li>'); } } </script>
結果はこんな感じ