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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
rnambiar
Frequent Visitor

Using Custom Python Libraries in Excel or PowerBI

Hi, 

I am trying to import a custom python library in to either Power BI or Excel.  I assume that libraries like pandas, numpy etc are included.  Is there a way to get around this?  Generally for conda -  I would do a pip install and start using it. 

 

Any thoughts or suggestions?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @rnambiar 

Thanks for the reply from Kedar_Pande , please allow me to provide addition:

Excel now supports Python integration, allowing you to use Python directly in Excel cells. However, this feature is limited to some built-in libraries. You can use the =PY function to write Python code in Excel cells, but custom libraries still need to be preprocessed outside of Excel. You can check the following link:

Open-source libraries and Python in Excel - Microsoft Support

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

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

View solution in original post

4 REPLIES 4
Kedar_Pande
Super User
Super User

@rnambiar ,
In Power BI, you can use built-in Python libraries like pandas and numpy. However, you cannot install custom libraries directly via pip or conda.

Workaround- Use another Python environment to preprocess data with your custom library, then export it (e.g., CSV) and import it into Power BI.

 

To use Python in Power BI go to Transform Data > Run Python Script.

 

If this helped, a Kudos 👍 or Solution mark would be great!
Cheers,
Kedar Pande
www.linkedin.com/in/kedar-pande

Thank you.  That works with Power BI.  Is there a way to accomplish the same in excel without having to go outside of excel to preprocess the data.  I'd like to be able to share this file with other users who dont use Python.

Anonymous
Not applicable

Hi, @rnambiar 

Thanks for the reply from Kedar_Pande , please allow me to provide addition:

Excel now supports Python integration, allowing you to use Python directly in Excel cells. However, this feature is limited to some built-in libraries. You can use the =PY function to write Python code in Excel cells, but custom libraries still need to be preprocessed outside of Excel. You can check the following link:

Open-source libraries and Python in Excel - Microsoft Support

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

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

Sorry, I am not an expert in Excel.

If this helped, a Kudos 👍 or Solution mark would be great!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.