Skip to content

Instantly share code, notes, and snippets.

@wittyking
wittyking / .readme.md
Created October 9, 2023 06:39 — forked from oshliaer/.readme.md
Using the Google Apps Script Cache Service for objects above 100Kb
@wittyking
wittyking / line-beacon-demo.gs
Created January 18, 2023 12:10 — forked from waseriin/line-beacon-demo.gs
Example implementation of webhook on Google Apps Script for LINE Simple Beacon with LINE Messaging API
const ACCESS_TOKEN = PropertiesService.getScriptProperties().getProperty('ACCESS_TOKEN');
const urlBase = 'https://api.line.me/v2/bot/';
const myId = PropertiesService.getScriptProperties().getProperty('MY_ID');
function doPost(e) {
const replyToken = JSON.parse(e.postData.contents).events[0].replyToken;
const beaconType = JSON.parse(e.postData.contents).events[0].beacon.type;
const userId = JSON.parse(e.postData.contents).events[0].source.userId;
const replyUrl = urlBase + 'message/reply';
@wittyking
wittyking / imageToText.gs
Created November 17, 2022 14:28 — forked from tagplus5/imageToText.gs
google apps script image to text ocr
function doGet(request) {
if (request.parameters.url != undefined && request.parameters.url != "") {
var imageBlob = UrlFetchApp.fetch(request.parameters.url).getBlob();
var resource = {
title: imageBlob.getName(),
mimeType: imageBlob.getContentType()
};
var options = {
ocr: true
};
@wittyking
wittyking / batch_ocr.gs
Created November 17, 2022 14:23 — forked from kltng/batch_ocr.gs
Google Apps script for performing OCR on all JPEGS found in the specified Drive folder. Extracts text to a Google sheet, where it's mapped to the JPEG's filename.
function extractTextOnOpen() {
//ADD YOUR VALUES BELOW
var folderName = "[YOUR PROJECT FOLDER]";
var sheetId = "[YOUR SHEET ID]";
//Define folder
var folder = DriveApp.getFoldersByName(folderName).next();
var folderId = folder.getId();
@wittyking
wittyking / index.html
Created September 26, 2022 12:13 — forked from jirawatee/index.html
LIFF Share Target Picker
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover">
<title>My LIFF App</title>
<style>
body { padding: 256px }
button { display: none; width: 50%; padding: 16px 0; margin: 16px auto }
</style>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover">
<title>ครูอภิวัฒน์"สอนสร้างสื่อ"</title>
<style>
body {padding: 25px;background-color: #46abb0;color: yellow;}
.button {width: 60%;padding: 8px 0;margin: 2px auto;font-size: 16px;border-radius: 10px;
// var Tempfolder = DriveApp.getFolderById('aaa')//โฟลเดอร์ชั่วคราว
// var fileSlide = DriveApp.getFileById('aaa')//ไฟล์สไลด์แม่แบบ
// var copyFile = fileSlide.makeCopy('test', Tempfolder)//คัดลอกไฟล์สไลด์ไปใส่ไว้ในโฟลเดอร์ชั่วคราว
var Tempfolder ;
var fileSlide ;
var copyFile;
function myFunction() {
var form = FormApp.openById('aaa'); // ***ใส่ form id***
var fRes = form.getResponses();
@wittyking
wittyking / maps.gs
Created June 12, 2020 05:53
ดึงพิกัดที่อยู่จากชีทแล้วสร้างเส้นทางบนแผนที่
/**
* Copyright Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@wittyking
wittyking / canvasOnFly.html
Created June 6, 2020 09:26
create canvas on the fly in html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
<script>
var count = 0;
for (var item = 0; item < 20; item++) {
if (count % 5 == 0) {
document.write(" ||| ");
<!DOCTYPE html>
<html>
<head>
<base target="_blank">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ฟอร์มรับสมัครนักเรียน</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css">