An open API service indexing awesome lists of open source software.

https://github.com/tichavich/devweb-googleappscript

Module GoogleAppScript for Google Sheet
https://github.com/tichavich/devweb-googleappscript

api appscript google googleappscripts googlesheets googlesheetsapi

Last synced: 11 months ago
JSON representation

Module GoogleAppScript for Google Sheet

Awesome Lists containing this project

README

          

# DevWeb-GoogleAppScript
### DevWeb-GoogleAppScript คืออะไร
เป็นโปรเจคที่สร้างขึ้นมาใช้สำหรับเช็คการเข้าทำงานหรือเข้าร่วมกิจกรรมของบริษัท โดยสร้างเขียน Google AppScript สร้างเป็นหน้าเว็บไซต์และเชื่อมต่อกับ GoogleSheet API เพือใช้เก็บข้อมูล
### ฟังก์ชั่นที่ทำงานร่วมกับ GoogleSheet
1. CreateDataSet ฟังก์ชั่นเขียนข้อมูล ต่อจาก Record ล่าสุด
function :
```
CreateDataSet=(sheet_index,data)=>{
let conSheet = SpreadsheetApp.openById(APPCONFIG.IDConnectSheet);
let selectSheet = conSheet.getSheetByName(APPCONFIG.sheetName[sheet_index]);
selectSheet.appendRow(data);
};
```
3. ReadDataOnceforCell ฟังก์ชั่นอ่านค่าข้อมูล โดยระบุตำแหน่งการเข้าถึงช่องเซลล์ เช่น A15 B26
function :
```
const ReadDataOnceforCell=(sheet_index,cell_name)=>{
let conSheet = SpreadsheetApp.openById(APPCONFIG.IDConnectSheet);
let selectSheet = conSheet.getSheetByName(APPCONFIG.sheetName[sheet_index]);
return selectSheet.getRange(cell_name).getValue();
};
```
5. ReadDataOnceforRowCol ฟังก์ชั่นอ่านค่าข้อมูล โดยระบุเป็นตัวเลขตำแหน่งแนวแถวและแนวคอลัมน์ เช่น ReadDataOnceforRowCol(1,5) 1 = ตำแหน่งแถว, 8 = ตำแหน่งคอลัมน์ ถ้าเป็นช่องเซลล์ก็เป็น H1
function :
```
const ReadDataOnceforRowCol=(sheet_index,row_num,col_num)=>{
let conSheet = SpreadsheetApp.openById(APPCONFIG.IDConnectSheet);
let selectSheet = conSheet.getSheetByName(APPCONFIG.sheetName[sheet_index]);
return selectSheet.getRange(row_num,col_num).getValue();
};
```
7. ReadDataOnceforRangeRowCol ฟังก์ชั่นอ่านค่าข้อมูล โดยระบุเป็นตัวเลขตำแหน่งแนวแถวและแนวคอลัมน์ กำหนดช่วงข้อมูล เช่น (1 = row,3 = column,5 = row,8 = column) ถ้าเป็นช่วงเซลล์ก็เป็น C1:H5
function :
```
const ReadDataOnceforRangeRowCol=(sheet_index,row,col,numRow,numCol)=>{
let conSheet = SpreadsheetApp.openById(APPCONFIG.IDConnectSheet);
let selectSheet = conSheet.getSheetByName(APPCONFIG.sheetName[sheet_index]);
return selectSheet.getRange(row,col,numRow,numCol).getValues();
};
```
9. ReadDataAll ฟังก์ชั่นอ่านค่าข้อมูลทั้งหมดที่อยุ่ใน Sheet
function :
```
const ReadDataAll=(sheet_index)=>{
let conSheet = SpreadsheetApp.openById(APPCONFIG.IDConnectSheet);
let selectSheet = conSheet.getSheetByName(APPCONFIG.sheetName[sheet_index]);
return selectSheet.getDataRange().getValues();
};
```