Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tichavich/DevWeb-GoogleAppScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

13 Commits

Repository files navigation

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);
    };
    
  2. 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();
    };
    
  3. 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();
    };
    
  4. 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();
    };
    
  5. 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();
    };
    

About

Module GoogleAppScript for Google Sheet

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /