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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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