SOLVED

script needed to find the last row and execute a copy function down

Copper Contributor

Hello everyone,

I have some large excel files with formulas that I am trying to copy down via a script and need help finding the right command (need to use online excel so NO VBA).  Here is a (greatly shortened) example of what I want to do:

Jeff_Hunt_0-1688739212558.png

Any help would be most appreciated.

 

3 Replies
best response confirmed by Jeff_Hunt (Copper Contributor)
Solution

@Jeff_Hunt 

That could be

 

function main(workbook: ExcelScript.Workbook) {
    
    const sheet = workbook
        .getWorksheet("Sheet1")

    const lastRowAddress = sheet
        .getUsedRange()
        .getLastCell()
        .getAddress()

    const lastRow = sheet
        .getRange(lastRowAddress)
        .getEntireRow()
        .getUsedRange()

        lastRow
        .getOffsetRange(1,0)
        .copyFrom(lastRow)

}

 

Works like a champ - will plug it into the big file to test.....

Many THANKS!!!!