【问题标题】:Apps Script: Change the value of some cells in Last RowApps 脚本:更改最后一行中某些单元格的值
【发布时间】:2022-01-28 04:20:52
【问题描述】:

这段代码正是我想要的:最后一行的值。现在我正在尝试覆盖/替换同一最后一行中某些单元格中的这些值。 “一些单元格”我特别指的是 2 个单元格,我想在其中放置来自另一个/运行良好的函数的新值。知道如何做到这一点吗?

非常感谢您的帮助:)。

function changeCellValueInLastRow() {

  var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("SHEET_NAME");
  var data = ws.getRange(ws.getLastRow(), 1, 1, ws.getLastColumn()).getValues(); 
  Logger.log(data);
}

【问题讨论】:

    标签: google-apps-script


    【解决方案1】:
    function changeCellValueInLastRow(v, col = 1) {
      if (v && col) {
        const ss = SpreadsheetApp.getActive();
        const sh = ss.getSheetByName('SHEET NAME');
        sh.getRange(sh.getLastRow(), col).setValue(v);
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-03
      相关资源
      最近更新 更多