Forum Discussion
Jeff_Hunt
Jul 07, 2023Copper Contributor
script needed to find the last row and execute a copy function down
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 (great...
- Jul 07, 2023
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) }
SergeiBaklan
Jul 07, 2023Diamond Contributor
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)
}
- Jeff_HuntJul 07, 2023Copper ContributorWorks like a champ - will plug it into the big file to test.....
Many THANKS!!!!- SergeiBaklanJul 08, 2023Diamond Contributor
Jeff_Hunt , you are welcome