A XLSB File error can come to you by surprise. Recently one of my clients built a Power Query solution. In one of the steps, the query ran into an unknown error. The query started with data from a CSV file. And then merges different Excel files to enrich the dataset. One of the merges results in the following error message.
“An error occurred in the ‘TBL_MAPPING_B2G’ query. DataFormat.Error: External table is not in the expected format. Details: TBL_MAPPING_B2G.xlsb”
This message indicates the name of the Query that causes an error. Yet it’s not very clear what’s going on. The table is not in the expected format…
Error Checking
So I did some basic error checking. This was my approach.
- First I examined the source data. Does the source data contain any errors? Strange formatting? Perhaps symbols that are not accepted? Inspecting the source file didn’t give me any indication of strange symbols or errors. Data seemed structured, without errors or strange symbols.
- Next, I looked at what the query looked like after importing it in Power Query. Are columns perhaps defined with the wrong data type? Do errors occur in any of the columns? Again, I found nothing noteworthy.
- The error message occurs in the step where the base query merged with ‘TBL_MAPPING_B2G’. To make sure nothing went wrong there, I perform the merge once more by deleting the old step and doing the merge again. The error message appeared again. The riddle continued.
I’m slowly running out of ideas. The query involves many different merges. So how is this particular merge different from the others?
Solution
The clue to the solution appeared when inspecting the source files. The merge resulting in an error is the only file saved with a .XLSB file type. All other files types are either .XLSX or .CSV.
Perhaps this influences how Power Query reads the data. Since the file causing the error contains macro’s, I save it as .XLSM. Next I change the source file in Power Query, press refresh and VOILA! The error message is gone!
That’s strange. The error message indicates the table is not in the expected format, yet changing the file extension solves the problem.
The exact reason of the XLSB File Error is still unclear to me. It appears there is a bug in Power Query when reading the .XLSB file. Yet changing the file type seems to solve the issue.
Checking Google for similar issues doesn’t give much input either. It’s not much, but on this page someone seems to have a similar problem. Until it’s fixed, the way to go is to change the file format.
Have you experienced similar issues? And what was your solution to it? Please let me know in the comments below. Also make sure to check out how to import files from a Folder if you want to expand your Power Query superpowers!
Recommended Reading…
Power Query Foundations
Beginners Guide to Power Query
List Functions (200+ Examples)
Text Functions (150+ Examples)
Creating Tables (40+ Examples)
Generate the Ultimate Date Table
Advanced Topics
Master List.Generate with Easy Examples
Deep Dive into List.Accumulate
It is possible to convert .xlsb to .xlsm using power query ?
I faced this issue as well. Resolved it with the Access Driver.
https://www.microsoft.com/en-us/download/details.aspx?id=13255
xls and xlsb are binary formats while xlsx, xlsm are open xml formats – that’s the difference.
PQ has difficulties to read properly binary formats.
Thanks Konstantin 🙏, that may explain the issue.
It is not possible that we can´t use any way connection with the xlsb files. We have enough problems working with multiple-placed files and interacting with too people to mantain it.
We need more complete solutions please!
It is not possible that we can´t use any way connection with the xlsb files. We have enough problems working with multiple-placed files and interacting with too people to mantain it.
We need more complete solutions please!
Thanks for this article – have been trying to find if it’s just me that found that queries fell over when I changed file formats to .xlsb from .xlsm. Not all queries, just some – and some still worked albeit incredibly slow. As far as bugs go it’s a random one and not widely discussed so likely no solution on the horizon.
Conversely I change my data source from xlsm (because the file is too big for an excel file which is not required for any Marcos) to xlsb. Therefore changing back to format of xlsm does not seem to be the best solution for me. I am still looking for the right shot for the xlsb.
Hi Tijl, Great that it helped you! Happy querying 🙂
Hi Rick,
Had the same issue that Tables are not recognized if stored in a .xlsb
Luckily I found your solution, although it costed me a half hour troubleshooting…
Hi Gustavo! Strange Power Query doesn’t handle this. I’m happy to hear this seems to fix the problem for you !
^Rick
Thanks man, someone changed database as xlsx to xlsb. To solve i only changed xlsb to xlsm.
thx