[英]Cell reference in Google Sheets Script
從我的問題中,您會知道我是 Google 表格腳本的新手。 我正在創建一個宏以在特定列中的特定字符串下方插入一個單元格。 例如,我需要在值為“Red”的單元格下方插入一個單元格。 如果“紅色”在 A5 中,那么我需要單元格 A6,而 A6 將在宏中多次使用。 任何答案表示贊賞!
祝一切順利!
function findRed() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('Sheet1');
let f = sh.createTextFinder('Red').findAll();
let fA = f.map(r => { return {row: r.getRow(),col: r.getColumn()}} );
Logger.log(JSON.stringify(fA));
}
Execution log
11:12:41 AM Notice Execution started
11:12:41 AM Info [{"row":1,"col":1},{"row":4,"col":2},{"row":6,"col":4},{"row":8,"col":6},{"row":10,"col":8}]
11:12:42 AM Notice Execution completed
第 1 列 | Col2 | 第 3 列 | 第 5 列 | 第 5 列 | Col6 | Col7 | Col8 |
---|---|---|---|---|---|---|---|
紅色的 | |||||||
紅色的 | |||||||
紅色的 | |||||||
紅色的 | |||||||
紅色的 |
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.