I want to Set Formula for some cell, depend on how much data I have. The problem was, I can't write script to make Range without Row Initial ( e.g Range(A:AA)). To make just Column Initial, I try to replace Parameter : lastCol and lastRow with blank string ('') , and Zero Number (0), but not work. Thanks
function recap() {
var   sheet             =   SpreadsheetApp.getActiveSpreadsheet()
var   sheetForm         =   sheet.getSheetByName('METER')
const sheetPrint        =   sheet.getSheetByName('CETAK TAGIHAN')
const n                 =   5
var   lastRow           =   sheetForm.getLastRow()
var   lastCol           =   n+4
const startRow          =   7 
const currentCol        =   3 
for (let i = 0 ; i < n; i++){
// FORMULA =vlookup((max(METER!A:A)),METER!A:I,5)
// HOW TO SET ALL COLUMN RANGE :(A:I) WITHOUT ROW NUMBER
sheetPrint.getRange(i+startRow,currentCol).setFormula('vlookup((max(METER!A:A)),METER!'+sheetForm.getRange(1,1,lastRow,lastCol).getA1Notation()+','+(5+i)+')');
}
}
 
    