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 / Unattended PAD Flow Fa...
Power Automate
Unanswered

Unattended PAD Flow Failing after Midnight

(0) ShareShare
ReportReport
Posted on by 32

I'm having trouble with an unattended PAD flow running after midnight without needing to intervene with the computer.

 

I have a PAD flow that opens an Excel file with multiple data connections from a OneDrive synced SharePoint folder, running a simple macro to refresh the data connections and recalculate cells, then save-as to SharePoint (via the synced OneDrive folder) with date in the filename.

 

All seems to work reliably, until midnight, and throws errors for opening the file in Excel.  Below is a snap of one night's run history, alternating PAD runs on two different machines; both failing after midnight.  Sometimes simply logging into the machine remotely and allowing OneDrive to open and sync will allow the next runs to work, and other times I've had to manually open the file from OneDrive in Excel while logged in.

 

Any idea what would be changing at midnight that would cause a failure in launching the file in Excel?

 

PAD Failure Hist.png

I have the same question (0)
  • mbarbosa Profile Picture
    146 on at

    Hey @Chris803 ,

    does the Excel file name have any dates or something like that, that when the day changes could be affecting the flow?

  • Chris803 Profile Picture
    32 on at

    Hi @mbarbosa ,

     

    Thank you for taking a look.

     

    No, the name of the file being picked up is static. 

     

    The PAD flow does do a save-as to archive the updated file with a dated name, but the PAD flow failure after midnight is always opening the static file with Excel.

  • mbarbosa Profile Picture
    146 on at

    What about the folder in which the file is? also static?

    Is the flow trying to open the file after the SaveAs action? could it be that the error comes after that?

    If it's always after midnight I'm 90% sure it has something to do with the date.

  • Chris803 Profile Picture
    32 on at

    The folder is static as well.

     

    Interestingly, after troubleshooting this issue for over a week, it worked last night.  The change I made was to open the file as read-only and not to save prior to the save-as.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    The usual problem with modifying Excel files on SharePoint/OneDrive is that the OneDrive app has the auto-sync feature on by default. This messes up with PAD editing the file, and it will usually fail. If your flow fails to save and close, it may also fail to open the same file afterwards. It may not necessarily have anything to do specifically with flows running after midnight. It might simply be caused by OneDrive's sync.

     

    If possible, I would suggest making your flow copy the file to a local directory first before making changes. Then making the changes and then moving the file back to the target directory. It should work fine when the file is local.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Chris803 Profile Picture
    32 on at

    Hi @Agnius,

     

    Thanks for your thoughts.  Over the weekend we experienced a couple more failures beginning at midnight.  Today I changed one of our desktop flows to use your suggestion of opening and saving with a local folder and then copying to the SharePoint location.  So far it's been working well.  I'll feed back if it resolves the midnight issue.

  • Chris803 Profile Picture
    32 on at

    Unfortunately, opening the file from a local folder was not successful.  After running all day, it still failed to launch Excel beginning at midnight.

     

    I saved the file locally and in a folder not backed up by OneDrive, and opened from there.

     

    Screenshot 2023-09-20 1.jpgScreenshot 2023-09-20 2.jpg

    Problem while executing action 'LaunchAndOpenUnderExistingProcess'. Failed to open Excel document 'C:\AutomationFiles\[myfilename].xlsm' (Active workbook retrieval error).

    Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK.ActionException: Failed to open Excel document 'C:\AutomationFiles\[myfilename].xlsm' (Active workbook retrieval error). ---> System.Runtime.InteropServices.COMException: Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
    at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
    at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
    at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
    at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.GetProperty(Object o, String propertyName)
    at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.LaunchExcel(Variant documentPath, Variant readPassword, Variant writePassword, Variant& excelInstance, Int32 launchMode, Boolean visible, Boolean loadAddInsAndMacros, Boolean needsAuthentication, Boolean readOnly, Boolean launchInNewInstance)
    --- End of inner exception stack trace ---
    at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.LaunchExcel(Variant documentPath, Variant readPassword, Variant writePassword, Variant& excelInstance, Int32 launchMode, Boolean visible, Boolean loadAddInsAndMacros, Boolean needsAuthentication, Boolean readOnly, Boolean launchInNewInstance)
    at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.LaunchExcel.Execute(ActionContext context)
    at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

  • mbarbosa Profile Picture
    146 on at

    googling that error, it seems to be (at least most of the times) a timing issue. Meaning that the automation is trying to interact with Excel before it is ready. I think maybe is a longshot, given that the issue only appears after midnight, but perhaps you can try adding some delay before the failing action.

  • Chris803 Profile Picture
    32 on at

    Thanks for you thoughts, @mbarbosa .

     

    I have had some delays just prior to the Launch Excel step.  Currently it's 10s, but it was about a minute for a while until I decided it probably wasn't necessary.  I might go ahead and add it back longer just to see if it helps.

  • Chris803 Profile Picture
    32 on at

    I've been able to further prove it has something to do with the date change in that PAD fails to open the file from any location (OneDrive folder synced from SharePoint, direct SharePoint address, or even a locally saved folder).

     

    I successfully tested the PAD flow, both attended and unattended, then changed the time zone such that it was the next day, and then re-ran the flow only to see it fail trying to open the file.

     

    This directly replicates what we've been seeing overnight.  The only way to fix the failure is to manually open the file and re-save.  After doing that, the flow will run again until midnight.

     

    This is very frustrating considering that this is supposed to automate a comprehensive production report for a manufacturing plan in the early mornings.

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
David_MA Profile Picture

David_MA 298 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 150 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 147 Super User 2026 Season 2

Last 30 days Overall leaderboard