I have a flow which takes updates from an excel sheet (which has a data connection updating on a schedule) and uploads them to SharePoint. At the end of the flow I call an excel script which copies the table from one sheet to another, in order to drive the formulas in the 'Status' column (basically when the two sheets match the status is "Same", when new data comes into the data table the status will be "Update" if it is different or "New" if it is not found). The table is ~9670 rows.
I have never had any issues running it in Excel, but occasionally it will fail in Power Automate. It has run fine over the past few days (running every 15 mins) but then today it failed 5/10 times in the last few hours.
Here is my script:
function main(workbook: ExcelScript.Workbook) {
let compareSht=workbook.getWorksheet("Existing")
let rosterTbl = workbook.getTable("RosterTbl");
let RosterTblSht=workbook.getWorksheet("RosterTbl")
let lastRow = RosterTblSht.getUsedRange().getRowCount()
let lastCol = RosterTblSht.getUsedRange().getColumnCount()
let testCol: ExcelScript.RangeView = rosterTbl.getRangeBetweenHeaderAndTotal().getVisibleView()
compareSht.getRangeByIndexes(1,0,20000,15).clear()
compareSht.getCell(1, 0).copyFrom(RosterTblSht.getRangeByIndexes(1,0,lastRow+1,lastCol), ExcelScript.RangeCopyType.all,false,false)
The error I see more often is:
We were unable to run the script. Please try again.
Office JS error: Line 13: Range copyFrom: The request is aborted.
clientRequestId: 46a880d9-3443-4823-aa1c-9b893e1f0859
Occasionally it has fails with
We were unable to run the script. Please try again.
Your file was not saved because we could not merge your changes with changes from someone else.
clientRequestId: 99cd4341-4a43-41c0-9fba-7c692b2f5fdf