I'm trying to autofill Column F (with formula in F2). The number of autofill entry depends on Column E, which is always dynamic. When I record my automation, the script gave me a static number (F500 in this case). What do I need to do to have Column F autofill to the last row in Column E. I tried scouring the internet, but none of the suggestions worked in the Excel Code Editor.
// Set range F2 on selectedSheet
selectedSheet.getRange("F2").setFormulaLocal("=TEXT(E2,\"mm/dd/yyyy\")");
// Auto fill range
selectedSheet.getRange("F2").autoFill("F2:F500", ExcelScript.AutoFillType.fillDefault);
Any suggestion would be appreciated. I have zero coding knowledge.