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:
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...
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1