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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
darchale
Regular Visitor

Power Query/M interop with C#

Hi, I am currently in the testing/investigation stages of using Power BI at my company.

Almost all of our data sources are hidden behind http or grpc services. These services can return multiple data formats, for example: Apache Arrow, Apache Parquet, KDB/Kx, json and proprietory formats. Recently we have built an excel add-in for these services in C# using Excel DNA as the interop layer between both workbook and vba, and the add-in has a significant amount of code to do this. Ideally we would like to not repeat this work and simply call C# function within a power query/m custom connector.

 

The only thing that I can find is this quick reference to ADO.NET in a conference about building custom connectors, https://youtu.be/srQ-DLqhoxM?t=2815, however, I cannot find any further information on this or how to go about starting.

 

Please let me know if this is possible, and if it's not possible, if you can think of any other approaches to solving this. From what I can see M does not currently have the capability of deserialising arbitrary arrow, parquet or grpc data.

2 REPLIES 2
darchale
Regular Visitor

Hey @v-jingzhang, sorry, maybe I should have been more clear. My questions is actually kind of two questions in one:
1. Can M interop with C#?
For example, can I do something like either of the following:

 

MyCustomFunction = CSharp.Interop.GetFunction("MyCustomFunction")
Source = MyCustomFunction(...)  // Calls C# code under the hood

 

 or 

 

using MyCustomCSharpFunctions;   // Some external library e.g. a nuget package
shared CSharp.DataSource1 = () => MyCustomCSharpFunctions.GetDataSource1();   // Calls C# code under the hood

 

 

2. If this is not possible, does M have the ability to deserialise custom data types?

From your answer above it seems like the answer to this is no. Formats like arrow cannot be parsed in M yet?

v-jingzhang
Community Support
Community Support

Hi @darchale 

 

You can find the most common data types used in Power Query in the following article: Data types in Power Query - Power Query | Microsoft Learn

 

And you can find the complete list of data types in the Power Query M formula language from article M Language types - PowerQuery M | Microsoft Learn

 

I'm afraid some data formats you mentioned are not supported in Power Query. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors