Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Excel Adding Columns: Graph API has timed out

(0) ShareShare
ReportReport
Posted on by 3

Hi All,

 

I am attempting to create a power automate task that takes an emailed excel file, adds two columns with static contents for every row, and then saves the file to a local folder.

 

What I have created already worked for my test files - however it now throws an error when the spreadsheet is much larger (6000ish rows). The flow runs for approximately 20 minutes and then returns the error code 504, with message "Request to Graph API has timed out"

 

My Question is - is there a way to change these timeout settings as a workaround (I don't mind if it takes a long time to finish), or is there an alternative method within Power Automate / script suggestions that can accomplish this within the timeout limit?

 

Thanks!

 

"error": {
 "code": 504,
 "source": "australia-001.azure-apim.net",
 "clientRequestId": "--",
 "message": "BadGateway",
 "innerError": {
 "status": 504,
 "message": "Request to Graph API has timed out.\r\nclientRequestId: --",
 "error": {
 "message": "Request to Graph API has timed out."
 },
 "source": "excelonline-ae.azconn-ae.p.azurewebsites.net"

 

Here is the script I am using:

 

function main(workbook: ExcelScript.Workbook) {

 workbook.getApplication().setCalculationMode(ExcelScript.CalculationMode.manual);

 // Adding Class Column
 let range = workbook.getActiveWorksheet().getUsedRange();

 let rows = range.getRowCount();
 let cols = range.getColumnCount();

 range.getCell(0, cols).setValue("class");

 for (let row = 1; row < rows; row++) {
 range.getCell(row, cols).setValue(8);
 }

let updateCols = cols + 1

 range.getCell(0, updateCols).setValue("update");

 for (let row = 1; row < rows; row++) {
 range.getCell(row, updateCols).setValue("Y");
 }

 workbook.getApplication().setCalculationMode(ExcelScript.CalculationMode.automatic); 

}

 

Flow steps for background:

Flow_error.JPG

 

 

  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: Excel Adding Columns: Graph API has timed out

    Hi Sam, 

    If I am not wrong, your script is trying to update the values cell by cell. From my limited knowledge and what I have experienced so far, this approach may not work for the large data set. 

     

    Change the approach to update the excel in batches for range of values. It should work.

    It worked for me and I could update 300K records with the batch approach. 

     

    There is MS documented example... 

    https://docs.microsoft.com/en-us/office/dev/scripts/resources/samples/write-large-dataset?view=office-scripts

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1