[Python] Python in Excel - Change Excel Namespace

Discussão em 'Python' iniciado por Stack, Maio 29, 2025.

  1. Stack

    Stack Membro Participativo

    Can I alter the namespace of Excel using a Python-in-Excel function?

    I can access the excel namespace from python. Let's say, I named cell C17 "my_excel_variable". I can access its value in python:

    xl("my_excel_variable")


    Now I am wondering, if there is a function, with which I can define my own variables in python, that I can call in an excel-formula.

    Whats the application?

    In my line of work, we work with standardized material data:

    • Concrete of class C20/25 has a compressive strength (f_ck) of 20 MPa and a tensile strength (f_ctm) of 2.2 MPa.
    • For C50/60 its 50 MPa and 4.1 MPa resepectively.

    What is the goal?

    I am looking to build a function, that is simply accessed

    load_material_properties_to_excel_namespace('C20/25')


    after which i can use the properties in excel formulas throughout my spreadsheet

    =.85 * f_ck / 1.5


    Thank you for your consideration

    Continue reading...

Compartilhe esta Página