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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
JoeAnalyst
Frequent Visitor

We were unable to load this Excel file because we couldn't understand its format.

Hi,

I have a automated solution in place about 10 months but few days ago, the scheduled refresh of the report published to Powerbi Service started to not finish the refresh and stooppped on error: "DataFormat.Error: We were unable to load this Excel file because we couldn't understand its format. File contains corrupted data.. Microsoft.Data.Mashup.ErrorCode = 10942. ;We were unable to load this Excel file because we couldn't understand its format. File contains corrupted data.. The exception was raised by the IDbCommand interface. ".

The solution uses scheduled exports from the company application , the exported files have xlsx format and are saved using Power Automate to the sharepoint folder. The exported data file is not corrupted, it has no password, sensitivity label and it seems it did not change formating at all (I compared older exports = looked the same). I tried many times to export file, change data in the report. The powerBI desktop works fine with that xlsx fomat, I can reload data, all steps in power query work. I tried to republish to the other workspace but no change. The scheduled refresh on service simply stopps on the error message. It worked I think until Friday 13th 2025 (the date? :-). I have noticed new PowerBI version was released on June 10th with some new features about sensitivity lableling but this should not be the case. Why does it work in Dektop but not after publish? Any good advice from anyone? Thank you in advance.

1 ACCEPTED SOLUTION
fr_jc
Advocate II
Advocate II

@JoeAnalyst  Managed to get a work around which works for me by running an empty office script in the power automate flow to act as an open and save.  

After the create file action, use an excel Run Script action.

function main(workbook: ExcelScript.Workbook) {
  // This script doesn't need to make any explicit changes or call a 'save' method.
  
  // You can add a simple log to confirm it ran if you wish, but it's not strictly necessary.
  console.log("Office Script ran successfully for workbook: " + workbook.getName());
}

 

View solution in original post

66 REPLIES 66
mcasetellano
Regular Visitor

I don't understand the root of the problem. My files come from Service Now. Some of the users here don't use a flow from Power Automate but get the same error, so the flow is not the problem. In fact, my flows run successfully and I opened the files and confirmed the data is updated. How do we raise a ticket with Microsoft? 

 

Hi, the power automate flow is not the problem, in this case it is the advantage to use flow because there is only one working workaround - to add to the flow one small step that after file is saved to the sharepoint it will open/close file automaticaly and it does all the magic. It is enouch open and close (with some void action) and the structure of the xlsx file will be corrected. Power BI is then able to load the file as before. I am not an expert on the xlsx versions but the xlsx export that I use from other sources are ok, only SalesForce generates these 'incorrect' files. I dont know whether Microsoft is troublemaker here, yes, they changed something on PowerBI side on June 10th but if other xlsx versions are fine, maybe the SalesForce app shoud be fixed instead. Anyway the workaround works for now, you can find the guide here in this discussion how to add one more step "Run Script" to the flow with dynamic way how to get file ID so it shoud work olso on your side. From your first post I understood that you already impelented it but it is not working, now it seems you did not yet, so just try to impelent it and you should be safe.

Yes I tend to aggree with "I dont know whether Microsoft is troublemaker here." 
I too am no expert but if you look at the Content_Types xml on a new file and an older xlsx file you where getting before the problem started you get,

fr_jc_0-1750894128535.png

Look at one from when the problem started and you get a whole lot of <overide> custom entries.

fr_jc_1-1750894188844.png

I'd suspect that this is where the query conncetors excel loader fails to read and understand the format.

The open and save action is simply rebuilding the xml back to the orignal state where the excel loader can understand it.


mcasetellano
Regular Visitor

I am experiencing the same problem. The excel files are not corrupted. I have two power automate flows to update the files on sharepoint, one triggers when I get the email with the data extract and another flow triggers daily 4.30am as a backup. The flows run successfuly but when Bi runs the schedule refreshes it fails and I get the same error described by JoeAnalys

Hi, Can you see the files are really updated by the flow? I am able to see in the file Version History that the flow did its job and created new version and also the size of the file is a bit higher (about 200kB). From when I implemneted this workaround about a week ago I havo no more issues. I have 10 files updated daily, all work perfectly. 

Hi Joe, thanks for your prompt response. Yes, I can see the files get updated. I will try implementing the work around you used but it is a lot of files, would prefer that whatever is causing this, got fixed. I had no problems before, my report have been running and refreshing with no issues for months. 

pb1051
Advocate II
Advocate II

The script solution didn't work for me. Even the action doesn't recognize the file type. I'm submitting a ticket.

leaves5887
Regular Visitor

Is there an issue reported for this? We are experiencing the same issue and would like to report it to Microsoft.

samtrapp
Regular Visitor

I am also having this same issue, running a scheduled Salesforce export as an Excel file, Power Automate pulls it out of Outlook and creates a SharePoint file source for Power Bi. Issue started on June 7, 2025 with no issues for the previous 2 months. 

gbroughton
New Member

Exact same problem for me, also Salesforce data.

Poojara_D12
Super User
Super User

Hi @JoeAnalyst 

You're encountering a frustrating issue where a previously stable Power BI report—automated for over 10 months—suddenly fails to refresh in the Power BI Service, despite working flawlessly in Power BI Desktop. The error message points to a DataFormat.Error with code 10942, indicating that the Excel file is seen as having a corrupted format or unreadable structure. However, you’ve confirmed that the file is structurally sound, has no password protection or sensitivity labels, and opens fine in Power BI Desktop, which suggests the file itself is not actually corrupted. The XLSX files are generated via scheduled exports from your company application and stored on SharePoint via Power Automate, and nothing significant has changed in the export logic or formatting.

 

Given that everything works in Desktop but fails in the Service, the issue likely stems from how the Power BI Service is attempting to parse or access the Excel file in the cloud environment. A key difference could be the version of the mashup engine or stricter validation in the Service following the June 10th Power BI update, which may have introduced changes to how the service handles Excel files, possibly around metadata, internal structure, or SharePoint file locking. One possible root cause is that the exported Excel file—though appearing normal—might be slightly malformed or still being written or locked when Power BI Service attempts to access it, especially if the refresh schedule overlaps closely with file generation.

 

To mitigate this, try the following steps: (1) introduce a buffer time between file export and dataset refresh, (2) check if opening and saving the Excel file manually (e.g., via Excel desktop or online) "fixes" the issue, and (3) consider using CSV format instead, which is less error-prone in automated workflows. If the issue persists, it might be worth opening a support case with Microsoft—even if you're on Power BI Pro, this type of regression affecting file compatibility might be considered for escalation if enough users report it.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

Our first failure was on June 11th. So this is align with what you have said in your post.

 

I tried a delay action in my Power Automate, but this did not solve the issue.

 

I have attempted the script solution that @JoeAnalyst suggested, but my trigger is a SharePoint "When a file is created or modifed (properties only)" and the script doesn't work for us. 

 

We can open the file manually and make a small change and save the file and then Power BI service can read the file properly.

 

I have now opened a ticket under our Pro/Premium support.

 

All to say, you are most likely right in the root cause.

fr_jc
Advocate II
Advocate II

@JoeAnalyst  Managed to get a work around which works for me by running an empty office script in the power automate flow to act as an open and save.  

After the create file action, use an excel Run Script action.

function main(workbook: ExcelScript.Workbook) {
  // This script doesn't need to make any explicit changes or call a 'save' method.
  
  // You can add a simple log to confirm it ran if you wish, but it's not strictly necessary.
  console.log("Office Script ran successfully for workbook: " + workbook.getName());
}

 

Hi fr_jc,

I'm new to Power Automate and I wasn't familiar with scripts in Excel Online before reading your post.

Thank you for that. 

So I tested your solution and it still doesn't work. I created a script that changes the format of a cell in an Excel file previously saved via Power Automate (saving a file when it arrives in my email inbox on a shared cloud). Everything works, except for the automatic report refresh, which still displays the error (DataFormat.Error: We were unable to load this Excel file because we couldn't understand its format. File contains corrupted data.. Microsoft.Data.Mashup.ErrorCode = 10942. ;We were unable to load this Excel file because we couldn't understand its format. File contains corrupted data.. The exception was raised by the IDbCommand interface.).

I wasn't familiar with scripts in Excel Online

 

Here is the power automate :

upon the arrival of a new email, Power Automate creates the files in a shared cloud and then executes the script :

MAMTAIKI_0-1769073018240.png

and here is the script : 

 

function main(workbook: ExcelScript.Workbook) {
  let selectedSheet = workbook.getActiveWorksheet();
  // Set fill color to FFFF00 for range A1 on selectedSheet
  selectedSheet.getRange("A1").getFormat().getFill().setColor("FFFF00");
}

 

Can you help me please ?

Thank you very much in advance.

This is the first time I've written a script in Excel Online. It seems to work, but the refresh function still doesn't recognize the Excel file format.

Hi @MAM-TAIKI your script is ok, no problems with it.

Can you confirm that the excel file once created into sharepoint has the yellow background on A1 on the selected sheet?

Not that this is a problem if you email has only ever got one single xlsx attachment, but I notice in your flow you have no condition, so if you have more than one attachment each will be saved as per your ‘create file’ settings, including signature images ect.  
The other thing is you should move the run script up into your ‘for each’, again this is not real;y an issue if you have just the one attachment.
These don't seem to be your current problem as the run script would fail if the file created as xlsx was from a different non xlsx file type.

Hi fr_Jc,

Thank you for your reply.

Actually, I've discovered what was causing the problem in my Power BI.

I have another table that comes from a file generated by a query in an application on the AS/400. Since I changed PCs last december, my query format has changed. I contacted our IT department to fix the problem.
I'll leave the Power Automate update :  it's now saving the file correctly to our cloud, and cell A1 is indeed highlighted in yellow.

Thanks again.

Best regards.

Nice, glad you go it sorted. 😀

Hi everyone,
I know this post has been marked as resolved and that a long time has passed since the last reply. However, from the comments I can see that many users (myself included) have encountered issues, mainly related to automatic extraction in Salesforce. So I wanted to share my frustrating experience and explain how, after hours and hours of debugging, the issue is currently being handled.

Premise: for one of my clients, it was necessary to develop a Power BI report using data coming from daily Salesforce extractions delivered through two files. Obviously, the data needs to be merged for reporting purposes, so—like many of you—we set up a Power Automate flow that uploads these files daily to a SharePoint site.

This project started in 2024, so I had to deal with the infamous change introduced in June 2025. At this point, I would split the issues I encountered into two main problems:


1) First of all, starting from June 2025, Salesforce—in my case—changed the structure of the Excel file and the format in which it was sent, causing the refresh to fail even in Power BI Desktop. This issue was resolved by modifying the connection string in Power Query to standardize the extractions.

In the image below, you can see that I no longer connect directly to a specific worksheet, but instead to the overall data structure of the Excel file (this might be an issue that only I encountered).

 

Alemagic95_0-1768920730559.png


2) However, the key point—at least based on my experience, and the reason why I decided to reply for the first time—is understanding how to efficiently debug a refresh in the Power BI Service. Let me explain: while @Fr_jc’s solution works, I believe that most of you, like me, use Power Query to append all the extracted files. In my case, doing the math, there were almost 800 files that potentially needed to be retroactively fixed. More importantly, the real challenge was identifying which files were causing the refresh to fail, since even a single problematic file is enough to block the entire refresh.

My solution was to modify the Power Query code to allow the Power BI Service to continue the refresh while logging the files that caused errors into a separate table, which could then be visualized directly in the report. Below is a screenshot of the M code and the simple result obtained.


PowerQuery code:

Alemagic95_1-1768930754223.png

 

Refresh result:

 

Alemagic95_2-1768930793333.png

 



Hello @JoeAnalyst  @Han5404513  @pb1051  @90_eryka  @AlBi999 

I am facing same Issue at Power BI Serivce,

Ca you please Guide Where to write This Code for Run Script?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.