Create materials (from Excel to Revit)

I believe it’s due to improper formatting.

for mat_name, color in zip(names, colors):
    TransactionManager.Instance.EnsureInTransaction(doc)
    new_mat_id = Material.Create(doc, mat_name)
    new_mat = doc.GetElement(new_mat_id)
    new_mat.Color = ToRevitColor(color)
    TransactionManager.Instance.TransactionTaskDone()
    newMaterials.append(ToDynamoObject(new_mat))

Honestly not sure why it ran in the first place, but moving your transaction to the next line and indenting everything fixes the problem.