Exporting Schedules to CSV format

Hi there,

I am trying to export multiple schedules to CSV format. I have made the below workflow that works fine in my system but in other systems, the Schedules Exporter node gives a null output (in every Revit project files).

I can’t figure out the cause. Is there an OOTB workflow for the same?

This is the Python code for Schedule.Exporter, just in case.

import clr

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *

clr.AddReference(“RevitAPIUI”)

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

def tolist(obj1):
if hasattr(obj1,“iter”): return obj1
else: return [obj1]

schedules = UnwrapElement(tolist(IN[0]))
path = IN[1]
exportTitle = IN[2]
exportColumnHeaders = IN[3]
exportHeadersFooters = IN[4]

opt = ViewScheduleExportOptions()
opt.Title = IN[2]
if not exportColumnHeaders:
opt.ColumnHeaders = 0
opt.HeadersFootersBlanks = IN[4]

i = 0
for s in schedules:
n = s.ViewName.ToString()+“.csv”

s.Export(path, n, opt)
i=i+1

OUT = i.ToString() + " schedules exported"

Hello
the View.ViewName property is deprecated in Revit 2019 (remove in Revit 2020).

  • Replace by View.Name property
2 Likes

Thank you. Could you please mend the script or perhaps point out where is this property?
I don’t know much Python.

for s in schedules:
	n = s.Name +".csv"
2 Likes

Thanks @c.poupin. It works fine in Revit 2020.

Earlier I was using Revit 2019 for exporting.

7 posts were split to a new topic: Exporting Schedules to Excel via csv