Forum Discussion

rnambiar's avatar
rnambiar
Frequent Visitor
1 year ago
Solved

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?

  • Anonymous's avatar
    Anonymous
    1 year ago

    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.

4 Replies

  • 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

    • rnambiar's avatar
      rnambiar
      Frequent Visitor

      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.

      • Kedar_Pande's avatar
        Kedar_Pande
        Super User

        Sorry, I am not an expert in Excel.

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