'Replacing Dim (X) as Long in Excel Script

I am new to Excel Scripts in Sharepoint but I am familiar (not an expert) with VBA. I need to find how I can find the last row in excel sharepoint similar to using

Dim L and Long L = Range("A" & Rows.Count).End(xlUp).Row

This is to apply a formula to the cells. Currently I have

//Set range F1 on selectedSheet selectedSheet.getRange("F1").setFormulaLocal("=max(F3:F1050)")

The final cell was recorded using CRTL+SHIFT+DOWN but in this column, there is the possibility of blank data in range F where as column A has complete data so would define the cell number.

I am hoping to get some such as

selectedSheet.getRange("F2).setFormulaLocal("=max(F3:F.....)")

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source