-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCode.js
More file actions
52 lines (46 loc) · 1.89 KB
/
Code.js
File metadata and controls
52 lines (46 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// application setting
const APPCONFIG = {
IDConnectSheet:"google_sheet_api",
sheetName:["record","employ","building","issue"]
}
//CRUD
CreateDataSet=(sheet_index,data)=>{
let conSheet = SpreadsheetApp.openById(APPCONFIG.IDConnectSheet);
let selectSheet = conSheet.getSheetByName(APPCONFIG.sheetName[sheet_index]);
selectSheet.appendRow(data);
};
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();
};
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();
};
const ReadDataOnceforRangeRowCol=(sheet_index,row,col,numRow,numCol)=>{
//// Print values from a 3x3 box (1,1,3,3)
let conSheet = SpreadsheetApp.openById(APPCONFIG.IDConnectSheet);
let selectSheet = conSheet.getSheetByName(APPCONFIG.sheetName[sheet_index]);
return selectSheet.getRange(row,col,numRow,numCol).getValues();
};
const ReadDataAll=(sheet_index)=>{
let conSheet = SpreadsheetApp.openById(APPCONFIG.IDConnectSheet);
let selectSheet = conSheet.getSheetByName(APPCONFIG.sheetName[sheet_index]);
return selectSheet.getDataRange().getValues();
};
function ResponseDataSet(pasingArr){
CreateDataSet(0,pasingArr);
}
//Extranal files
function IncludeFiles(filename) {
return HtmlService.createHtmlOutputFromFile(filename).getContent()
}
//response to webpage
function doGet(e) {
return HtmlService.createTemplateFromFile('index').evaluate()
.setTitle("HR")
.addMetaTag('viewport','width=device-width , initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}