Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
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,
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?
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.