Trouble in running OfficeScripts in Excel Online Sharepoint

Anu Tomy 0 Reputation points
2025-08-19T10:19:09.6066667+00:00

I hope you are all doing well. I'm reaching out to bring to your attention an issue I've been encountering with running Office Scripts on Excel Online in SharePoint. While the script functions perfectly on the Excel desktop application, I keep receiving an error message when attempting to run it on Excel Online. The error message reads: "An unexpected error occurred. Close the task pane to try again."

I have tried the below fixes:

1)have enabled the option below in admin centre:

Image preview

  1. Tried deleting browser history, enable third party cookies
  2. Tried running on a different workbook( it is an .xlxs file)
  3. Tried running on a different browser(Egde <-> Chrome)
Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Liora D 2,495 Reputation points Microsoft External Staff Moderator
    2025-08-19T11:15:59.7933333+00:00

    Hi @Anu Tomy

    Thank you for contacting Microsoft Q&A Support and for sharing the steps you've already tried, that’s very helpful. 

    To better understand the issue and provide more targeted assistance, could you please help clarify a few things: 

    1. What does your Office Script do? 
      If possible, please share the script code or describe its main actions. This will help identify if it uses any APIs not supported in Excel Online. 
    2. Where is the Excel file stored? 
      Is it saved in SharePoint, OneDrive, or opened from a local folder? 
    3. How are you running the script? 
      Are you using the Excel Online task pane, or triggering it via Power Automate? 
    4. Have you checked for any error details in browser Developer Tools? 
      You can press F12 in your browser, go to the Console tab, and run the script again to see if any technical error appears. 

     
    In the meantime, here are a few steps you can try: 

    • Test with a simple workbook 
      Create a new .xlsx file with minimal content and try running a basic script to rule out workbook-specific issues. 
    • Check file permissions 
      Make sure you have edit access to the workbook and it's not locked by another user. 
    • Try running a sample script from Microsoft Learn 
      This helps confirm whether the issue is with your script or the environment: Office Scripts samples - Office Scripts | Microsoft Learn 
    • Run the script via Power Automate 
      If it works there, the issue may be specific to the Excel Online task pane. 

    Looking forward to your response so I can assist you further! 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.