Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
jos_ger
New Member

API call runs twice

Hi all!

 

I'm trying to create a Power Query that takes variables from an Excel Table and runs an API POST call.

 

I get it to work, BUT for some reason, it runs the call twice each time. Since it's a POST call, this is not tolerable, as duplicate records are not acceptable. 

 

I've been troubleshooting several hours but now I'm stuck. Anyone who know what I can do? I would deeply appreciate any ideas.

 

The code:

 

let
url = "XXX", // my URL
xml = "XXX", // my XML
headers = [#"Content-Type"="application/xml"],
options = [Headers=headers, Content=Text.ToBinary(xml)],
Source = Web.Contents(url, options)
in Source

 

 

 

 

What I've tried:

  • Deselect “Allow data preview to download in the background” (as mentioned as a possible solution elsewhere).
  • Use Table.Buffer as in:

 

headers = [#"Content-Type"="application/xml"],
options = [Headers=headers, Content=Text.ToBinary(xml)],
Source = Web.Contents(url, options),
XmlTable = Xml.Tables(Source),
BufferedTable = Table.Buffer(XmlTable)
in BufferedTable​

 

 

 

 

 

2 REPLIES 2
ImkeF
Community Champion
Community Champion

Hi @jos_ger ,
Power Query is not suitable for write back, as it will by default execute queries multiple times: The first execution is to retrieve metadata in order to create a query execution plan. After that it will execute the execution plan.
There is no way you can suppress that.

Easiest way would probably be to use a tool like Power Automate.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

BA_Pete
Super User
Super User

Hi @jos_ger ,

 

Are you referencing this query at all? If you reference a query, in almost all cases both queries will actually hit the source.

Also, your table buffer isn't doing anything here except filling up memory then getting dumped out again. Object buffers aren't persistent in Power Query in that way.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.