Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I am Getting the Following Error while refreshng in powerBi service . I have a bunch of file all are coming from the sharepoint folders.But from where can i check this error it doesnot state the document name and all . Please can anyone help !!
Data source error: DataFormat.Error: Xml processing failed. Either the input is invalid or it isn't supported. (Internal error: Reference to undeclared entity 'ndash'. Line 10, position 19.). . The exception was raised by the IDbCommand interface.
Thanks
Hi @Batman020
The error you’re seeing — “DataFormat.Error: Xml processing failed... Reference to undeclared entity 'ndash'” — indicates that one of the files being imported from your SharePoint folder contains invalid XML content or a special character (in this case, “–” representing an en dash) that Power BI’s parser can’t interpret. This usually happens when Power BI encounters a nonstandard or malformed XML/HTML entity in a file it’s trying to read (often in Excel, XML, or HTML exports). Because the error message doesn’t specify which document is causing it, you’ll need to isolate it manually. The best way to do this is to open your Power BI file in Power BI Desktop, go to Power Query Editor, and step through the applied steps of your SharePoint Folder query. At the point where the query expands or transforms files, add a temporary step (e.g., filter by file name or extension) and preview each file’s content until the error appears. This will reveal which specific file or files contain invalid XML characters. Once identified, open that file in a text or XML editor, replace or remove the “–” entity (or save the file in UTF-8 format), and re-upload it to SharePoint. Then refresh again in Power BI. Essentially, the issue isn’t with the connection but with malformed data in one or more of your source files, and checking the files individually in Power Query is the most efficient way to pinpoint and fix it.
Hi @Batman020,
Thank you for reaching out to the Microsoft Fabric Community, and special thanks to @tayloramy and @djurecicK2 for their prompt and helpful responses.
Thanks for the clarification. As @tayloramy mentioned, could you please confirm whether you're using Excel files stored on SharePoint or XML files as your data source? This will help us determine if the issue is related to the connector being used.
Thanks & Regards,
Prasanna Kumar
But i am using the the sharepoint file connecter in my powerbi desktop it all works fine in the dekstop as expected but as soon as in the service it crashes with this error on refresh , And actually i have a lot of sheets in my excel file and the data is also huge so how do i find that ndash and replace , can u guide me if i am using the wrong connected for it which is causing the error
Thanks
Hi @Batman020,
Sorry, I'm now confused. Are you using XML files as your source, or are you using Excel files?
I am using excel files as my source and they are stored in my onedrive and through there i am accessing it
Hi @Batman020,
If you're using Excel files and not XML files, there is no need to do any XML parsing. Use the Excel file connector, or the Web or SharePoint Folder connectors to connect and parse the Excel file directly.
If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
Hi @Batman020,
You’re hitting an XML parser error during refresh because one of the files coming from SharePoint contains an HTML entity (–) inside text that Power BI is trying to parse as XML. In XML, entities like – are not defined unless a DTD declares them, so the parser stops with “Reference to undeclared entity ‘ndash’…”.
Refs: try ... otherwise | SharePoint Folder connector | Xml.Tables | Html.Table
let
Source = SharePoint.Files("https://contoso.sharepoint.com/sites/YourSite", [ApiVersion = 15]),
KeepCols = Table.SelectColumns(Source, {"Name","Extension","Content"}),
LikelyTypes = Table.SelectRows(KeepCols, each List.Contains({".xml",".xlsx",".xls",".html",".htm"}, Text.Lower([Extension]))),
TryParse = Table.AddColumn(
LikelyTypes, "ParseResult",
each try
if [Extension] = ".xml" then Xml.Tables([Content])
else if List.Contains({".html",".htm"}, Text.Lower([Extension])) then Html.Table([Content], {{"Dummy", "body"}})
else if List.Contains({".xlsx",".xls"}, Text.Lower([Extension])) then Excel.Workbook([Content], true)
else null
otherwise null
),
HasError = Table.AddColumn(TryParse, "HasError", each Value.Is([ParseResult], type error)),
ErrorText = Table.AddColumn(HasError, "ErrorText", each if [HasError] then try Error.Reason([ParseResult]) otherwise "Unknown error" else null),
Diagnostics = Table.SelectRows(ErrorText, each [HasError] = true)
in
Diagnostics(entityText as text) as text =>
let
Map = {
{"–","-"},{"—","-"},{" "," "},{"‘","'"},{"’","'"},
{"“","""},{"”","""},{"&","&"}
},
Cleaned = List.Accumulate(Map, entityText, (state, pair) => Text.Replace(state, pair{0}, pair{1}))
in
CleanedUsage:
let AsText = Text.FromBinary([Content], TextEncoding.Utf8), CleanText = @CleanEntities(AsText), BackToBin = Text.ToBinary(CleanText, TextEncoding.Utf8), XmlParsed = Xml.Tables(BackToBin) in XmlParsed
Html.Table([Content], {{"All", "//*"}})
If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
Hi @Batman020 ,
– (en dash), which is not a pre-defined entity in XML.
– with the actual en dash character (–) in the source XML data.– with its numerical character reference, which is – (hexadecimal) or – (decimal).= Table.ReplaceValue(Source, "–", "–", Replacer.ReplaceText, {"YourColumnName"})
"YourColumnName" with the actual name of the column containing the XML data or the text with the – entity.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.