Excel-dynamo-revit

Hello, i’m trying to export an excel schedule to a material takeoff schedule using dynamo. i made the routine but the result is empy list.

I’m using parameter material “mark” and the resulting columns with shared parameters, by type, an materials checked. also AI made me the pyhyton script, it seems to work but the result is no excel information updated to the revit schedule.

i appreciate some help, thanks!

You don’t have a category selected to return any elements. If providing the proper category still doesn’t work, you’ll need to share the python code so we can see what it actually does.

Thanks a lot for your feedback!. Please refer to attached image regarding the python script.

Regards,

Sorry! this the actual script for the dynamo. thanks a lot!

If I had to guess it is because you are matching excel Mark to materials and not Elements.

Let me know if this works for you

import clr

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.TransactionManager import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

elements = IN[0]
excel_data = IN[1]

if elements is None:
    elements = []
if excel_data is None:
    excel_data = []

if (not excel_data) or (len(excel_data) < 2):
    OUT = "ERROR: Excel data is empty or incorrectly formatted"
else:
    marks_excel = excel_data[0]
    values_excel = excel_data[1:]

    if marks_excel is None:
        marks_excel = []
    if values_excel is None:
        values_excel = []

    if len(marks_excel) > 0 and isinstance(marks_excel[0], str):
        first_cell = marks_excel[0].strip().lower()
        if first_cell == "mark":
            marks_excel = marks_excel[1:]
            trimmed = []
            for col in values_excel:
                if col is None:
                    trimmed.append(col)
                else:
                    trimmed.append(col[1:])
            values_excel = trimmed

    param_names = [
        "pc.Tipo de acabado",
        "pc.Fabricante",
        "pc.Modelo",
        "pc.Dimensiones",
        "pc.Color",
        "pc.Sellador",
        "pc.Notas",
        "pc.Juntas",
        "pc.Especificacion_tecnica"
    ]

    elem_dict = {}
    for e in elements:
        try:
            p = e.LookupParameter("Mark")
            if p is None:
                continue
            mk = p.AsString()
            if mk is None:
                continue
            mk = mk.strip()
            if mk == "":
                continue
            if mk not in elem_dict:
                elem_dict[mk] = e
        except:
            pass

    updated = []

    TransactionManager.Instance.EnsureInTransaction(doc)

    for i in range(len(marks_excel)):
        mk_cell = marks_excel[i]
        if mk_cell is None:
            continue
        mk = str(mk_cell).strip()
        if mk == "":
            continue

        elem = elem_dict.get(mk)
        if elem is None:
            continue

        row_result = {"Mark": mk}

        for p_idx in range(len(param_names)):
            pname = param_names[p_idx]
            param = elem.LookupParameter(pname)
            if (param is None) or param.IsReadOnly:
                continue

            value = None
            try:
                col = values_excel[p_idx]
                if col is None:
                    value = None
                else:
                    value = col[i]
            except:
                value = None

            if value is None:
                continue

            try:
                param.Set(str(value))
                row_result[pname] = str(value)
            except:
                row_result[pname] = "FAILED TO SET"

        updated.append(row_result)

    TransactionManager.Instance.TransactionTaskDone()

    OUT = updated

Thank you, i’m gonna give it a try, but as far as i’ve read, it´s not possible for dynamo to assign text from excel via shared parameters to materials. I tried for elements, checking also each category (walls, cielings, floors and roofs), but i did not work either.

I would stay away from this when you don’t know Python :snake: yourself.
You now (and in the future) rely on others to troubleshoot.

Also you don’t need Python to export to Excel.

Just my 2 cents.

I’ll second this, and add that ‘the AI wrote it and as it worked for me we pushed it to production’ is how 1.49 MILLION api keys (the passwords that allow applications to communicate with paid cloud services) were leaked on the open web last week.

2026 is going to be the year someone’s vibe coded tooling comes back to haunt us all…