線上書籍

Home

台南社大-點2下社團

  1. 查看記錄 Logger.log("Hello World");



  2. Google Service 配額:https://developers.google.com/apps-script/guides/services/quotas 
     
  3. 連結試算表


     
  4. 建立一個試算表:
    取得id:
    取得url:


     
  5. 寫入資料 function myFunction() { //Logger.log("Hello World"); var url = "https://docs.google.com/spreadsheets/d/1TSFg5mocDvsaYOxHjClSAKhOJKtN4sc_gxDpQTkzNGc/edit#gid=0"; var ss = SpreadsheetApp.openByUrl(url);//打開試算表 var name = "聯絡我們";//工作表 var ws = ss.getSheetByName(name);//取得工作表 //姓名、電話、email、聯絡內容 var row = ["姓名","電話","email","聯絡內容"]; ws.appendRow(row);//寫入資料 }

     
  6. 練習["name","tel","email","content"] 寫入
      function myFunction() { //Logger.log("Hello World"); var url = "https://docs.google.com/spreadsheets/d/1TSFg5mocDvsaYOxHjClSAKhOJKtN4sc_gxDpQTkzNGc/edit#gid=0"; var ss = SpreadsheetApp.openByUrl(url);//打開試算表 var name = "聯絡我們";//工作表 var ws = ss.getSheetByName(name);//取得工作表 //姓名、電話、email、聯絡內容 //var row = ["姓名","電話","email","聯絡內容"]; //ws.appendRow(row);//寫入資料 //寫入資料另一種方法 //name、tel、email、content var row = ["name","tel","email","content"]; var lastRow = ws.getLastRow()+1; // 得到最新列指標 // getRange(row位置, col位置, row數量, col數量) ws.getRange(lastRow, 1, 1, row.length).setValues([row]); }
     
  7.