Skip to content

Instantly share code, notes, and snippets.

@neno-tech
neno-tech / code.gs
Created January 25, 2022 08:48
Google form + pdf + sendMail
function formSubmit(e) {
let info = e.namedValues
let pdfFile = createPDF(info)
let entryRow = e.range.getRow()
let ws = SpreadsheetApp.getActive().getSheets()[0]
let userMail = ws.getRange(entryRow, 2).getValue()
ws.getRange(entryRow, 6).setValue(pdfFile.getUrl())
sendEmail(userMail, pdfFile)
}
function sendEmail(email, pdfFile){
@neno-tech
neno-tech / css.html
Last active February 11, 2024 02:29
การทำระบบ Login แบบ Facebook
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background-color: #f0f2f5;
@neno-tech
neno-tech / code.gs
Last active March 5, 2023 11:00
โค้ดอัปเดตเว็บแอปของขวัญปีใหม่ 65 อัปโหลดหลายไฟล์แบบโค้ดสั้น
// ฟอร์มเว็บแอปแบบครบทุก input
function doGet() {
return HtmlService.createTemplateFromFile('index')
.evaluate()
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
}
function saveData(obj) {
var bdate = obj.data4.split("-")
var thaiDate = LanguageApp.translate(Utilities.formatDate(new Date(bdate[0], parseInt(bdate[1]) - 1, parseInt(bdate[2])), 'GMT+7', 'dd-MMMM-yyyy'), 'en', 'th').split('-').map((a, i) => { if (i != 2 || parseInt(a) > 2100) { return a }; a = parseInt(a) + 543; return a }).join(' ')
@neno-tech
neno-tech / index.html
Last active January 3, 2022 08:07
โค้ดทำพลิกภาพ cardflip
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
body{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
@neno-tech
neno-tech / index.html
Created December 20, 2021 12:26
web app Google Form
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2"
crossorigin="anonymous">
<title>this is my web page</title>
<style>
body{
@neno-tech
neno-tech / swal.html
Last active July 25, 2022 11:39
โค้ดแสดงผล Sweet Alert เป็นแบบตาราง html
var swal_html = `
<div class="panel" style="background:aliceblue;font-weight:bold">
<div class="panel-body">
<div class="text-center">
<table class="table">
<tbody>
<tr>
<th scope="row">รหัสนักเรียน :</th>
<td>${result[0][0]}</td>
</tr>
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<style>
@neno-tech
neno-tech / code.gs
Created December 3, 2021 09:17
เว็บแอปเช็คการส่งงานของนักเรียน
function doGet(e) {
return HtmlService.createTemplateFromFile('index').evaluate();
}
var ss= SpreadsheetApp.getActiveSpreadsheet();
function getStudents(){
var studentValues = ss.getSheets()[0].getDataRange().getValues();
return studentValues;
}
@neno-tech
neno-tech / code.gs
Last active October 1, 2022 02:43
เว็บแอปติดต่อเรา+ส่งอีเมล
function doGet(){
return HtmlService.createTemplateFromFile('index').evaluate()
}
function formatMailBody(obj,order) {
var result = "";
for (var idx in order) {
var key = order[idx];
result += "<h4 style='text-transform: capitalize; margin-bottom: 0'>" + key + "</h4><div>" + sanitizeInput(obj[key]) + "</div>";
}
return result;
@neno-tech
neno-tech / code.gs
Created December 3, 2021 08:46
ส่งเมลจากชีต+แนบไฟล์
function onOpen(){
var ui = SpreadsheetApp.getUi();
ui.createMenu('ส่งอีเมล')
.addItem('ส่งอีเมลพร้อมแนบไฟล์', 'sendPDFForm')
.addItem('ส่งอีเมลให้ทุกคน', 'sendFormToAll')
.addToUi();
}
function sendPDFForm(){
var row = SpreadsheetApp.getActiveSheet().getActiveCell().getRow();