Last active
March 4, 2023 10:11
-
-
Save neno-tech/a24c055ffd794565d9856ff0c3f4c4c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet() { | |
return HtmlService.createTemplateFromFile("index") | |
.evaluate() | |
.addMetaTag('viewport', 'width=device-width, initial-scale=1') | |
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL) | |
} | |
function getSheetData() { | |
var data = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getDataRange().getValues() | |
return data | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<base target="_top"> | |
</head> | |
<body> | |
<center><br> | |
<h2>ตารางแสดงข้อมูล</h2> | |
<table border="3" style="border:2px solid black" cellpadding="5px" > | |
<?var tableData = getSheetData();?> | |
<?for(var i = 0; i < tableData.length; i++) { ?> | |
<?if(i == 0) { ?> | |
<tr> | |
<?for(var j = 0; j < tableData[i].length; j++) { ?> | |
<th><?= tableData[i][j] ?></th> | |
<? } ?> | |
</tr> | |
<? } else { ?> | |
<tr> | |
<?for(var j = 0; j < tableData[i].length; j++) { ?> | |
<td><?= tableData[i][j] ?></td> | |
<? } ?> | |
</tr> | |
<? } ?> | |
<? } ?> | |
</table></center> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment