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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Action 'Run_script' Fa...
Power Automate
Unanswered

Action 'Run_script' Failed

(0) ShareShare
ReportReport
Posted on by 49

Hello, I received the following error on my Run script in my flow: "We were unable to run the script. Please try again.
Office JS error: Line 5: Workbook addTable: A table can't overlap another table.
clientRequestId: 39e632d2-9e17-4eaa-b8af-c3bd0cbb115c"

My flow is pulling data and importing it into an Excel spreadsheet
 
Here's the output script:
 
{
    "host": {
        "connectionReferenceName""shared_excelonlinebusiness",
        "operationId""RunScriptProd"
    },
    "parameters": {
        "source""sites/***.sharepoint.com,5a206f53-f5f0-4393-9233-f40debbcf70e,cdbf5d29-9e7d-4588-9d78-2f27cd4371b3",
        "drive""b!U28gWvD1k0OSM_QN67z3Dildv819nohFnXgvJ81DcbOaOXofGtvgRJt8PKw3vvHQ",
        "file""File",
        "scriptId""ms-officescript%3A%2F%2Fonedrive_business_itemlink%2F01TE7DZHDEGE5R37SUGBA2UZBRBXRQ5MCB"
    }
}

 

 

Categories:
I have the same question (0)
  • MichelleRanMSFT Profile Picture
    Microsoft Employee on at

    Hi @cswanson22 - it looks like this error is because your script tried to create a table in a range where there's already a table. Try double-checking your script and worksheet to make sure this isn't the case. If you're not able to identify the issue, though, would you be able to share your script, flow, and an example workbook (sensitive data removed as necessary) so we can try to reproduce this?

  • cswanson22 Profile Picture
    49 on at

    Hi MichelleRanMSFT, 

     

    Thank you for responding. I have attached the 2 files requested. 

  • MichelleRanMSFT Profile Picture
    Microsoft Employee on at

    Can you share your script code as well?

  • cswanson22 Profile Picture
    49 on at
    {
        "inputs": {
            "host": {
                "connectionName""shared_excelonlinebusiness",
                "operationId""RunScriptProd",
                "apiId""/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"
            },
            "parameters": {
                "source""sites/***s.sharepoint.com,5a206f53-f5f0-4393-9233-f40debbcf70e,cdbf5d29-9e7d-4588-9d78-2f27cd4371b3",
                "drive""b!U28gWvD1k0OSM_QN67z3Dildv819nohFnXgvJ81DcbOaOXofGtvgRJt8PKw3vvHQ",
                "file""@variables('File_Path')",
                "scriptId""ms-officescript%3A%2F%2Fonedrive_business_itemlink%2F01TE7DZHDEGE5R37SUGBA2UZBRBXRQ5MCB"
            },
            "authentication""@parameters('$authentication')"
        },
        "metadata": {
            "operationMetadataId""e1588403-58d5-4d4b-bb18-684475ba9ec7",
            "tableId"null
        }
    }
  • MichelleRanMSFT Profile Picture
    Microsoft Employee on at

    By script code, I mean the contents of the script when you open it in the Code Editor in Excel. For example:

    Screenshot 2023-05-26 081201 edit.png

    That's the best way to help us to understand what your script does and what might be going wrong.

  • cswanson22 Profile Picture
    49 on at
    Sorry for the confusion and thank you for your patience
     
    function main(workbook: ExcelScript.Workbook) {
      // This action currently can't be recorded.
      let selectedSheet = workbook.getActiveWorksheet();
      // Add a new table at range A1:AC141 on selectedSheet
      let newTable = workbook.addTable(selectedSheet.getUsedRange(), true);
      // Rename table newTable to "Charge_Data"
      newTable.setName("Charge_Data");
    }
  • Verified answer
    MichelleRanMSFT Profile Picture
    Microsoft Employee on at

    Thanks for sharing! If I'm understanding correctly, your script is trying to create a table over the used range in a worksheet, and the file/workbook is a dynamic parameter passed into the run script action?

     

    If so, then your error is probably because you're running the script on a worksheet that already has a table somewhere. You could check this by modifying your script like so:

    function main(workbook: ExcelScript.Workbook) {
    	let selectedSheet = workbook.getActiveWorksheet();
    	if (selectedSheet.getTables().length > 0) {
    		console.log('This worksheet already has a table. Stopping script.');
    		return;
    	}
    	// Add a new table at range A1:AC141 on selectedSheet
    	let newTable = workbook.addTable(selectedSheet.getUsedRange(), true);
    	// Rename table newTable to "Charge_Data"
    	newTable.setName("Charge_Data");
    }

    It'd also be helpful to understand how you pass the file parameter into the run script action (i.e., show the previous steps of the flow).

  • cswanson22 Profile Picture
    49 on at

    Try to get this part of the automation to run to update Power Bi information,

    cswanson22_0-1685207051581.png

     

  • cswanson22 Profile Picture
    49 on at

    I'm new to this whole and currently learning. I'm trying to fix an issue with a recent failed flow. The information from the table is sent to Power Bi. I updated the code with your information and now getting the current error: Request to Graph was malformed
    clientRequestId: f09a1d0e-879a-495f-93c6-62190dfc4dd9

    I don't see this clientRequestId anywhere. Thank you and sorry if I'm being a pain in the behind.

  • cswanson22 Profile Picture
    49 on at

    Here is the flow and the section that is getting the error. I'm now getting 'Request to Graph was malformed
    clientRequestId: 2a5a6e66-a386-47e7-9430-9a4c5cea9f83' after making the changes you sent last week. Thank you

     

    Flow1.png

    FlowSection.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard