差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:google_spreadsheets_tips [2019/05/15 12:07] jonathan_tsaitech:google_spreadsheets_tips [2021/12/21 08:57] (目前版本) – [原始資料彙整與排序] jonathan
行 1: 行 1:
 ====== Google Spreadsheets(試算表) 使用技巧 ====== ====== Google Spreadsheets(試算表) 使用技巧 ======
 +===== 取排序後的第一筆資料 =====
 +  * 參考 - https://stackoverflow.com/questions/50019391/last-row-in-google-sheets
 +  * 使用 Google 表單回報, 可能先前回報錯誤會在回報一次更正, 所以彙整資料時取出相同回報人的最後一筆回報資料就變得很需要
 +  * Exp. <cli>array_constrain(sort(filter('日期資料篩選表'!$A:$G, '日期資料篩選表'!$D:$D=D3),1,false),1,7</cli>
 +  * 主要使用 array_constrain 這個 function 來處理, 配合 sort 與 filter 將最後一筆資料取出來
 +    * '日期資料篩選表'!$A 是表單的回報時戳
 +    * array_constrain(資料清單,筆數,欄位數) -> 取 1 筆, 7 個欄位(A..G)
 +
 +===== 對多欄位進行 or 篩選 =====
 +  * 參考 - https://yagisanatode.com/2020/02/15/google-sheets-how-to-use-or-inside-a-filter/
 +  * 因為預設 filter 後面的多條件是 and 的篩選方式, 如果要進行 or 的篩選要改用以下的方式處理<cli>
 +=FILTER(A1:C8,((A1:A8 ="Goat") + (C1:C8 = "Handsome")))
 +</cli>
  
 ===== 讀取另一個 Google Spreadsheets 內容 ===== ===== 讀取另一個 Google Spreadsheets 內容 =====
行 22: 行 35:
   * 範例檔案 - https://docs.google.com/spreadsheets/d/1VeSoR9muNzVQy8eqSJsvvdwc_wgZh1zarl3JiaawE_o/edit?usp=sharing   * 範例檔案 - https://docs.google.com/spreadsheets/d/1VeSoR9muNzVQy8eqSJsvvdwc_wgZh1zarl3JiaawE_o/edit?usp=sharing
  
 +===== 使用 Query 來篩選彙整資料表內的資料 =====
 +  * 參考 - https://developers.google.com/chart/interactive/docs/querylanguage
 +  * Exp. 假設有一個來源分頁紀錄原始資料, 希望可以針對特定欄位進行加總排序產生彙整後的資料
 +  * <cli>
 +=query('(DB)專案資訊'!A3:EK, "
 +select A , B, M, sum(O), sum(P), sum(Q), sum(R) 
 +where (M!='' and M!='#N/A'
 +group by M, A, B 
 +order by A, B, M 
 +label A '部門', B '中心', M '六碼', sum(O) 'T.建立', sum(P) 'T.更新', sum(Q) 'T.Git', sum(R) 'T.Pipe'
 +", -1)
 +</cli>
  
  
 {{tag>GoogleDocs Spreadsheets 試算表 tips}} {{tag>GoogleDocs Spreadsheets 試算表 tips}}
  
  • tech/google_spreadsheets_tips.1557893221.txt.gz
  • 上一次變更: 2019/05/15 12:07
  • jonathan_tsai