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 / Excel Online (Business...
Power Automate
Unanswered

Excel Online (Business) Create Table Error

(0) ShareShare
ReportReport
Posted on by 32

Greetings,

 

I'm trying to create a flow that copies an excel file from one sharepoint site to another sharepoint site. Then the flow will need to convert the worksheet to a table. My flow is running correctly except for the Create Table function. I keep getting the error: "The operation failed because it conflicts with a filtered range." I'm assuming this means that, because my excel online file contains filters it cannot convert the range to a table. Is there anyway to remove filters from an excel online workbook?

Categories:
I have the same question (0)
  • Rodrigo Hentz Profile Picture
    on at

    Hi @djmitz6 how are you?

     

    Regarding your question and If I understood correctly your needs, to remove a filter in a table at Excel maybe you can create a script and then call it on Power Automate.

     

    My sample below clear applied filter on my table "Tabela1"

     

    rohentz_0-1611168741454.png

     

    And then I call it from Power Automate using this action. Just change the script name ok?

     

    rohentz_1-1611168797185.png

     

    The run script action still on preview but you can check it at https://docs.microsoft.com/en-us/office/dev/scripts/tutorials/excel-power-automate-manual

     

    Please let me know if this information helped on your question.

     

    Regards.

    Rodrigo Hentz

    Microsoft Support Engineer

     

  • djmitz6 Profile Picture
    32 on at

    Rohentz,

     

    Thank you for the response, but I'm trying to create a table. Currently the workbook is just a filtered range without a table. So running a script that calls a table that doesn't exist won't work.

  • djmitz6 Profile Picture
    32 on at

    @rohentz 

     

    Here is an example of a filtered non-table: 

    djmitz6_0-1611171997829.png

     

     

  • Verified answer
    Rodrigo Hentz Profile Picture
    on at

    Hi @djmitz6  thanks for the reply and the sample. I recorded a new script and the code to clear the filter is:

    2021-01-21-001.jpg

     

     
     

    Please let me know if this information helped on your question.

     

    Regards.

    Rodrigo Hentz

    Microsoft Support Engineer

  • Community Power Platform Member Profile Picture
    on at

    Is there any way if I can't access the Excel Script Tab?

    Thank you

  • Boipelo Profile Picture
    7 on at

    Good Day. May I kindly ask if you could help me with a very similar issue? Attached below is a snap of my flow. I get the error: The operation failed because it conflicts with a filtered range. However I run 2 excel scripts to remove the filters as well as unfreeze panes. The scripts work just fine, I.E, I successfully remove all filters and successfully unfreeze panes, however I still get this error. Could you please help me figure out what I am missing? Kind regards

    Boipelo_0-1658943373626.png

     

  • Community Power Platform Member Profile Picture
    on at

    I'm also struggling to remove filters from a worksheet. 

    I've incorporated your code:

     

    let currentWorksheet = workbook.
          getWorksheet("Sheet 1");

        // Get the range containing all the cells with data or formatting.
        let usedRange = currentWorksheet.getUsedRange();

        // Log the range's address to the console.
        console.log(usedRange.getAddress());
        currentWorksheet.getAutoFilter().clearCriteria;
        currentWorksheet.getAutoFilter().remove;
     
    //Add table
     let table1 = currentWorksheet.addTable(usedRange, true);
     
    The Output:
     Worksheet addTable: The operation failed because it conflicts with a filtered range.
    It's not removing the filters. Were you able to find the solution?
  • djmitz6 Profile Picture
    32 on at

    I tested using the following code and had no issues:

     

    The only items that I changed were renaming "Sheet 1" to "Sheet1"

     

    function main(workbook: ExcelScript.Workbook) {
    	let currentWorksheet = workbook.getWorksheet("Sheet1");
    
    	// Get the range containing all the cells with data or formatting.
    	let usedRange = currentWorksheet.getUsedRange();
    
    	// Log the range's address to the console.
    	console.log(usedRange.getAddress());
    	currentWorksheet.getAutoFilter().clearCriteria;
    	currentWorksheet.getAutoFilter().remove;
    
    	//Add table
    	let table1 = currentWorksheet.addTable(usedRange, true);
    }

     

     Image of Autofiltered Table that I used:

    djmitz6_0-1701292861550.png

    Image after running Script above:

    djmitz6_1-1701292922159.png

    Below is the console log output:

    Sheet1!A1:C6
  • Community Power Platform Member Profile Picture
    on at

    Thanks for testing it out. I've attached the excel that I'm having trouble with running this code on. Do you think the frozen panels affects the code? And if so, what would be the best course of action?

     

    Thanks!

  • djmitz6 Profile Picture
    32 on at

    Tangtang,

     

    I found the problem. You need to add the "()" after the .remove. See below code snippet.

     

    Also on your example you have merged cells in row 5. You will need to delete this row or modify the code to exclude this, because it is part of your used range so it will create generic header columns when you go to add the table.

     

    function main(workbook: ExcelScript.Workbook) {
    	let currentWorksheet = workbook.getWorksheet("Sheet 1");
    
    	// Get the range containing all the cells with data or formatting.
    	let usedRange = currentWorksheet.getUsedRange();
    
    	// Log the range's address to the console.
    	console.log(usedRange.getAddress());
    	currentWorksheet.getAutoFilter().clearCriteria();
    	currentWorksheet.getAutoFilter().remove();
    
    	//Add table
    	let table1 = currentWorksheet.addTable(usedRange, true);
    }

     

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