![](/img/trans.png)
[英]Is there a way to edit the same cell across multiple Google Sheet Files?
[英]Is there a way to iterate a formula across cells in a multiple selection - Google sheet
在谷歌表中,這個簡單的腳本適用於 select 單個單元格,然后單擊按鈕將所選單元格中的值減 1:
function tally() {
var cell = SpreadsheetApp.getActiveSheet().getActiveCell();
var value = cell.getValue();
cell.setValue(value-1);
}
有沒有辦法進行多項選擇 - 即 select 表格中的多個/分散的單元格,然后在每個選定的單元格中迭代 function ?
function tally() {
const rng = SpreadsheetApp.getActiveSheet().getActiveRange();
const values = rng.getValues().map(r=>r.map(c=>c-1));
rng.setValues(values);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.