Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
cxb
New Member

Custom connector for proprietary file type

We'd like Power BI Desktop to understand a custom file format and for users to be able to select a file of that type and have Power BI Desktop open it (generating probably multiple tables). Were I'm currently at with this is trying to create a custom connector for this and coming up against a number of issues. So a general question - is a custom connector the right way to go, or is there some other way to open a particular file type and have Power BI apply some Power/M query to extract the relevant data (bearing in mind the ideal is for the user to be able to select a file and have the data appear without delving into any data manipulation themselves)?

 

One of the issues I'm getting is with credentials - relevant section of code below. Accessing a test file using Visual Studio to debug (e.g. PQExtension1.Contents("\\path\to\test\file")) requests credentials when first running for Data Source Kind PQExtension1 (I select 'Windows' and Set Credential), but then requests credentials again when running subsequently, this time for Data Source Kind File. How to reuse the credentials previously entered?

section PQExtension1;

[DataSource.Kind="PQExtension1", Publish="PQExtension1.Publish"]
shared PQExtension1.Contents = (path as text) =>
    let
        Source = Xml.Tables(File.Contents(path)),
        pkg = Source{0}[pkg],
        pkgNav = GetLevelAsTable(pkg) //not getting as far as this
    in
        pkgNav;

PQExtension1 = [
    Authentication = [
        Windows = []
    ],
    Label = Extension.LoadString("DataSourceLabel")
];
...

So - is there a better way than custom connector and if not, can I reuse those credentials?

 

Many thanks

 

Craig

3 REPLIES 3
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi Craig,

 

After a lot of tests, I'm afraid the Xml.Tables could be unsupported for now. Please refer to docs/m-extensions.md#data-source-functions

>>> Currently, a limited set of data source functions have been enabled to support extensibility.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Dale (many thanks for the lot of tests!). So no to the custom connector route. Is there any means of using a particular M/power query to load a file with a specific extension though (or something similar)? E.g. .xyz files open (get pre-processed, effectively) with XYZ.pq.

I've raised this as a feature request - also sounds similar to this other feature request re applying query to file based on some filename pattern.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.