谷歌工作表中特定列中的最后一行

时间:2021-06-17 02:48:00

标签: google-apps-script google-sheets

知道如何在特定列获取 lastRow,在这种情况下,我想要范围 AJ 的 lastRow,直到仅 AX。

  var emailUser = Session.getActiveUser().getEmail();
  var ss2 = SpreadsheetApp.openById('1h2jmWV7mytPF_ltxYb2uPm4Pq7iHLg-hc3k_0X4Txvw');
  var ws2 = ss2.getSheetByName(emailUser);
  var lastRow = ws2.getLastRow();
  var rdPic = ws2.getRange(3,36,lastRow,50).getValues();
  var lrPic = rdPic.filter(String).length + 1;

  ws2.getRange("AJ"+lrPic).setValue(stock.tglMasuk1);
  ws2.getRange("AK"+lrPic).setValue(stock.namaPic1);
  ws2.getRange("AL"+lrPic).setValue(stock.locPIC1);
  ws2.getRange("AM"+lrPic).setValue(stock.teritori1);
  ws2.getRange("AN"+lrPic).setValue(stock.penyimpanan1);
  ws2.getRange("AO"+lrPic).setValue(stock.jenisTransaksi1);
  ws2.getRange("AP"+lrPic).setValue(stock.nmrDO1);
  ws2.getRange("AQ"+lrPic).setValue(stock.tglDO1);
  ws2.getRange("AR"+lrPic).setValue(stock.sn1);
  ws2.getRange("AS"+lrPic).setValue(stock.venname1);
  ws2.getRange("AT"+lrPic).setValue(stock.itm1);
  ws2.getRange("AU"+lrPic).setValue(stock.ponum1);
  ws2.getRange("AV"+lrPic).setValue(stock.bcd1);
  ws2.getRange("AW"+lrPic).setValue(emailUser);
  ws2.getRange("AX"+lrPic).setValue(dateNow);

0 个答案:

没有答案