google apps script - Display Spreadsheet data in Sites with Html Service -
i displaying want similar tutorial instead of using ui services display table, use html services. question mentioned use templated html display spreadsheet data in html. elaborated on topic? simple example this helpful because i'd see demonstration on works.
thank you!
there simple example of using templated html display table spreadsheet data available in documentation, here.
i've published a running copy, utilizing same data waqar's tutorial, easy comparison. source spreadsheet here, script. (edit: script provided below.)
code.gs
// code in script copied // https://developers.google.com/apps-script/guides/html-service-templates function doget() { return htmlservice .createtemplatefromfile('index') .evaluate(); } function getdata() { return spreadsheetapp .openbyid('0avf9feyqxfxadeplrhp5dgc4q1e3oxmyv2s4rktiqwc') .getdatarange() .getvalues(); }
index.html
<? var data = getdata(); ?> <table border='1px solid black'> <? (var = 0; < data.length; i++) { ?> <tr> <? (var j = 0; j < data[i].length; j++) { ?> <td><?= data[i][j] ?></td> <? } ?> </tr> <? } ?> </table>
Comments
Post a Comment