The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Dear all,
On the internet I find the information that Power Query will not read the table schema of an imported Excel file when using Excel.Workbook() as an Excel file is unstructured data.
https://support.microsoft.com/en-gb/office/add-or-change-data-types-power-query
In Power BI I activated the option -> Global - Data Load -> Type Detection: Never detect column types and headers for unstructured sources.
I used the following Power Query code to import the file:
let
Source = Excel.Workbook(File.Contents(filepath), true),
Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data]
in
Sheet
I can see that data types are applied to the columns in the table (number, date, ...)
So my question is if Power Query is automatically detecting the file types according to the values in the table when evaluating Excel.Workbook() or is it reading the types from an Excel schema?
Solved! Go to Solution.
Hi @WanderingBI ,
It's detecting the data types from the first 1,000 row values as default.
I'm unsure on exactly the mechanics it uses i.e. whether it prioritises the earlier row values, or whether it uses the most frequent type over the entire 1,000 rows, but this is the basic method.
Pete
Proud to be a Datanaut!
Hi @WanderingBI ,
It's detecting the data types from the first 1,000 row values as default.
I'm unsure on exactly the mechanics it uses i.e. whether it prioritises the earlier row values, or whether it uses the most frequent type over the entire 1,000 rows, but this is the basic method.
Pete
Proud to be a Datanaut!