Read data in Pre-created schedule in Revit

Hi Mark

You’ll need Python / Revit API. I believe there is a package that does this too but not sure which so maybe someone else on the forum can point you in the right direction.

I use this python script…next time, I’ll need to invoice you :wink:

If you use filters, this script will simply pick up the data thats visible

#Copyright 2016. All rights reserved. Bimorph Consultancy LTD, 5 St Johns Lane, London EC1M 4BH www.bimorph.co.uk
#Written by Thomas Mahon @Thomas__Mahon info@bimorph.co.uk

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
#
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

schedule = UnwrapElement(IN[0])

# "Start" the transaction
TransactionManager.Instance.EnsureInTransaction(doc)
		
#count the number of rows and columns in the schedule
table = schedule.GetTableData().GetSectionData(SectionType.Body)
nRows = table.NumberOfRows
nColumns = table.NumberOfColumns

#Collect all of data from the schedule
dataListRow = []
for row in range(nRows): #Iterate through the rows. The second row is always a blank space
	dataListColumn = []
	for column in range(nColumns): #Iterate through the columns
		dataListColumn.Add( TableView.GetCellText(schedule, SectionType.Body, row, column) )
	dataListRow.Add( dataListColumn );

# "End" the transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = dataListRow
10 Likes