Create an Empty Table with Explicit Types in Power Query M

Who'd a thought Explicit Types in an Empty Table would be so fulfilling... :/

me@jaykilleen.com wrote this almost 4 years ago and it was last updated almost 4 years ago.


← Back to the Posts

Back in the day, I thought, having a simple empty table in power query would have been enough. Here I am, adding explicit types to that 'simple' table... what it lacks in simplicity, it gains in the lack of a ChangeType instruction... which you are going to do anyway right?

I'll be honest, totally just copied from the docs here, but I do this often enough that I'll make some different code samples here so you can just grab what you need with different variations.

Original documentation at https://docs.microsoft.com/en-us/powerquery-m/expressions-values-and-let-expression#example-2--create-a-table-with-explicit-column-types

let  
  Source = #table(  
  type table [string = text, alphanumeric = text],   
    {   
      {"000123456", "000ABC123"}
    }  
  )  
in  
  Source

Similar