Forum Discussion
Refresh Failure in Power bi Service from Sharepoint folder but working via Desktop
Hi Everyone,
I'm encountering an issue with a published data source in Power BI Service that connects to multiple SharePoint folders and combines Excel files.
Context:
I regularly add or replace data by dragging and dropping Excel files into these SharePoint folders. This setup allows me to refresh the data and update the dashboard accordingly. For some datasets, I use Power Automate to automatically save incoming Excel files from emails directly into the SharePoint folder.
The issue:
When I refresh the data in Power BI Desktop after updating files in the SharePoint folder, everything works fine. I can then publish the report back to the workspace without issues.
However, when I try to refresh the dataset in the Power BI Service—whether manually, through scheduled refreshes, or via Power Automate—I consistently get error messages. Interestingly, the corrupted table mentioned in the error changes from one attempt to the next.
Here’s an example of the error I get:
Data source error: File contains corrupted data. The exception was raised by the IDataReader interface.
Table: Moyenne Programme_Focus Diff.
Cluster URI: WABI-EUROPE-NORTH-B-redirect.analysis.windows.net
Activity ID: 7a882140-998f-4123-9266-8356f7b677aa
Request ID: d03ac355-c3c8-755d-90b2-d45eb250062b
Time: 2025-04-24 10:11:11Z
What I’ve considered so far:
I've double-checked permissions and access rights to the public SharePoint site—no issue there.
After reading through various posts and documentation, I suspect one or more of the following could be the cause:
The way I combine files in Power Query: I use the "Combine files" feature with a "sample file" approach. I suspect this might break when the sample file changes due to the addition or replacement of files.
Power Automate: It might not be saving the file correctly into SharePoint, leading to file corruption or unreadable formats.
Confidentiality labels: Certain Excel files might have labels or protections that prevent proper reading during service refresh.
Has anyone experienced similar issues with SharePoint-connected sources or Power Automate flows? Do you have any advice on best practices to ensure reliable refreshes in Power BI Service?
Thanks in advance!
The fact that the failing table varies across refresh attempts suggests a transient issue with one or more files being unreadable or structurally inconsistent. This often happens with dynamically added files—particularly if their structure slightly deviates or is saved in a non-standard format.
Files dropped into SharePoint via Power Automate may not be finalized (i.e., not fully committed or in a locked state) at the time Power BI tries to read them. Also, encoding or file integrity issues can arise if the file is passed as a Base64 blob rather than natively copied.
"Combine Files" is what I would look at first. The default Combine Files transformation relies on the schema of a designated sample file. When structure varies across files—even slightly (e.g., extra columns, merged cells, header misalignment); Power BI Service may fail to parse some files. Desktop may be more forgiving or default to skipping those rows; the Service is stricter.
To fix it:
- In Power Query, after using the Combine Files wizard:
- Go to the Transform Sample File query and make it robust (e.g., remove dynamic column references, use explicit column names).
- Add schema validation steps early in the Transform File logic, e.g., a check like Table.ColumnNames(Source) = {"Col1", "Col2", "Col3"} to filter out malformed files.
- Optionally add a logging table of file names and whether they passed validation.
Another possible issue is if your org uses Purview or MIP labels to encrypt excel files. Office can encrypt these, but the Power BI Service cannot.
Last possible issue I’ll throw out is the classic file locking. Anytime you are dealing with SharePoint and Power Automate file locking is something you have to look out for. Delays in Power Automate are your friend.
Please mark this post as solution if it helps you. Appreciate Kudos.
- In Power Query, after using the Combine Files wizard:
Hello jdumas93 ,
When the sample file is deleted or replaced, the query steps that rely on it (usually applied steps in the transformation query) break during service refresh.
# In Power BI Desktop, it works fine because the file is still locally cached or freshly referenced.
# The error changing from table to table is a tell-tale sign of this—Power BI is attempting to read a table structure that no longer exists or has changed unexpectedly.
To fix this:
# Rebuild the combination logic with a more resilient sample file:-- Choose a permanent sample file that stays unchanged and isn’t one of the dynamically updated ones.
-- When using “Combine Files”, choose this as your sample query reference manually in the function.
# Make the transformation logic independent of file name/content:
-- Build logic that applies to all files in a generic way—e.g., referencing only columns that are always present.
5 Replies
- v-karpurapud
Community Support
Hi jdumas93
We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.
If our response was helpful, please mark it as the accepted solution and give a kudos, as this helps other members in community.
Thank you! - andrewsommer
Super User
The fact that the failing table varies across refresh attempts suggests a transient issue with one or more files being unreadable or structurally inconsistent. This often happens with dynamically added files—particularly if their structure slightly deviates or is saved in a non-standard format.
Files dropped into SharePoint via Power Automate may not be finalized (i.e., not fully committed or in a locked state) at the time Power BI tries to read them. Also, encoding or file integrity issues can arise if the file is passed as a Base64 blob rather than natively copied.
"Combine Files" is what I would look at first. The default Combine Files transformation relies on the schema of a designated sample file. When structure varies across files—even slightly (e.g., extra columns, merged cells, header misalignment); Power BI Service may fail to parse some files. Desktop may be more forgiving or default to skipping those rows; the Service is stricter.
To fix it:
- In Power Query, after using the Combine Files wizard:
- Go to the Transform Sample File query and make it robust (e.g., remove dynamic column references, use explicit column names).
- Add schema validation steps early in the Transform File logic, e.g., a check like Table.ColumnNames(Source) = {"Col1", "Col2", "Col3"} to filter out malformed files.
- Optionally add a logging table of file names and whether they passed validation.
Another possible issue is if your org uses Purview or MIP labels to encrypt excel files. Office can encrypt these, but the Power BI Service cannot.
Last possible issue I’ll throw out is the classic file locking. Anytime you are dealing with SharePoint and Power Automate file locking is something you have to look out for. Delays in Power Automate are your friend.
Please mark this post as solution if it helps you. Appreciate Kudos.
- In Power Query, after using the Combine Files wizard:
- anilelmastasi
Super User
Hello jdumas93 ,
When the sample file is deleted or replaced, the query steps that rely on it (usually applied steps in the transformation query) break during service refresh.
# In Power BI Desktop, it works fine because the file is still locally cached or freshly referenced.
# The error changing from table to table is a tell-tale sign of this—Power BI is attempting to read a table structure that no longer exists or has changed unexpectedly.
To fix this:
# Rebuild the combination logic with a more resilient sample file:-- Choose a permanent sample file that stays unchanged and isn’t one of the dynamically updated ones.
-- When using “Combine Files”, choose this as your sample query reference manually in the function.
# Make the transformation logic independent of file name/content:
-- Build logic that applies to all files in a generic way—e.g., referencing only columns that are always present.
- jdumas93New Member
Thanks for both replies ! I will try asap the different solutions (a permanent sample files looks promising!) and get back to you.
Thanks again
- jdumas93New Member
Hi !
Just to give an update :
- the way i was combing files was effectivly (one of) the issue. I changed by adding a sample file for each combining folder and it worked 🙂
- The power tutomate flow is still problematic and am trying to solve that now. With Time Delay as andrewsommer mentionned.
Thantks to you both !