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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.