Written By Rick de Groot

Rick is the founder of BI Gorilla. He believes learning is one of life's greatest pleasures and shares his knowledge to help you improve your skills.

Fix Error When Reading XLSB File In Power Query

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.

  1. 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.
  2. 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.
  3. 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!

Share this post:
  1. 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.

    Reply
  2. 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!

    Reply
  3. 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!

    Reply
  4. 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.

    Reply
  5. 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.

    Reply
  6. 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…

    Reply

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.