web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Run Script - 503 Conne...
Power Automate
Unanswered

Run Script - 503 ConnectionFailure

(0) ShareShare
ReportReport
Posted on by

"message": "The request failed with status code of 503."

"code": "ConnectionFailure"

"type": "Worksheet"

"method": "getRange"

"line":102

 

Just writing to a worksheet, updating the whole thing. The worksheet is over 140,000 records long. So, I copy it one go as such:

 

let myWorkbook = workbook.getActiveWorksheet()
let lastRow: number = myWorkbook.getUsedRange().getLastRow().getRowIndex() + 1
let values = myWorkbook.getRange(`A2:V${lastRow}`).getTexts()

 

Now, values is a 2D array. I process it how I need, then have to write it back to the worksheet. 

 

myWorkbook.getRange(`A2:V${values.length + 1}`).setValues(values)

 

Not so fast, says Automate. Yeah, ok. 140,000 is too much for internal memory to write. I get it.

So, I chunk it:

 

const CHUNK_SIZE: number = 500
const values_length: number = values.length
let chunk_arrays: string[][][] = []
 
for (let q = 0; q < values_length; q += CHUNK_SIZE) {
 chunk_arrays.push(values.slice(q, q + CHUNK_SIZE))
}

 

Now, the 2d array of 140,000 is broken up into chunks of 500. 

 

let upper_range: number
let lower_range: number = 1
for (let e in chunk_arrays) {
 upper_range = (lower_range + 1)
 lower_range = (upper_range + chunk_arrays[e].length)
 /*102*/ myWorksheet.getRange(`A${upper_range}:V${lower_range}`).setValues(chunk_arrays[e])
}

 

It works in desktop Excel, not in Run-Script-(Business)-Power-Automate-Excel-TypeScript.

 

503, anyone? Also, sometimes it tries to run for 25+ minutes in flow before crashing saying "BadGateway".

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 231 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 217 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 170

Last 30 days Overall leaderboard