Created
May 29, 2020 12:06
-
-
Save krooluang/d8975d3264a8fbdb582763b3bf5d8a84 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(e) { | |
return render("index"); | |
//return HtmlService.createHtmlOutputFromFile("index").setTitle('ระบบแจ้งอีเมล์โรงเรียน สพป.ชัยภูมิ เขต 1'); | |
} | |
function getCode(code) { | |
var url = "https://docs.google.com/spreadsheets/d/1fzRHrFv7PEZ86qp_KKO492hbBeliWkjVTc9OczWi9mY/edit"; | |
var ss = SpreadsheetApp.openByUrl(url); | |
var ws=ss.getSheetByName('แผ่น1') | |
var ws1=ss.getSheetByName('เมือง'); | |
var data = ws.getRange(1, 1, ws.getLastRow(), ws.getLastColumn()).getValues() | |
var data = ws1.getRange(1, 1, ws1.getLastRow(), ws1.getLastColumn()).getValues(); | |
var stdCodesList = data.map (function(r) { return r[0]; }); | |
var stdList = data.map(function(r) | |
{ | |
return [`<table class="table table-bordered"> | |
<thead class="table-success"> | |
<tr> | |
<th scope="col" colspan="3"><center>ข้อมูลเว็บไซต์โรงเรียน</center></th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td><b>โรงเรียน</b></td> | |
<td colspan="2">${r[1]}</td> | |
</tr> | |
<tr> | |
<td><b>เว็บไซต์</b></td> | |
<td colspan="2"><a href="${r[3]}" target="_blank">${r[2]}</a></td> | |
</tr> | |
<tr> | |
<td><b>อีเมล์</b></td> | |
<td colspan="2">${r[4]}</td> | |
</tr> | |
<tr> | |
<td><b>รหัสผ่าน</b></td> | |
<td colspan="2">${r[5]}</td> | |
</tr> | |
<tr> | |
<td><b>ผู้ดูแลระบบ</b></td> | |
<td colspan="2">${r[6]}</td> | |
</tr> | |
</tr> | |
</tbody> | |
</table> | |
`]; | |
}); | |
var position = stdCodesList.indexOf(code); | |
if(position > -1){ | |
return stdList[position];} else { | |
return 'ไม่พบข้อมูล'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment