Schedule GetCellText() returns empty strings

Hello everyone,
i’m currnetly trying to work with and understand schedules in Dynamo.
As one of the first steps i wanted to get the values of a schedule into a list in Dynamo.
Therefore i was using the GetCellText() method in the following code.

import clr
import sys
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager


doc = DocumentManager.Instance.CurrentDBDocument

schedule = UnwrapElement(IN[0])


sched = schedule.GetTableData()
body = sched.GetSectionData(SectionType.Body)

row_count = body.NumberOfRows
col_count = body.NumberOfColumns

ct = []

for row in range(row_count):
    for col in range(col_count):
        cell_text = body.GetCellText(row, col)
        ct.append(cell_text)

OUT = ct

As a result i’m left with many empty strings. How does this happen and what do i need to change? I’m using the Autodesk Golden Nugget project in RVT 24.
I’ve tried it with different schedules but the outcome is the same.

Thanks for the help in advance!

You may need to utilise the “GetCellType” method then change what you do depending on its type.

EG
If its a string you do what you have done, but if its a calculated value then you use that method.

TableSectionData Class

CellType Enumeration

1 Like

Hey Brendan,
i’ve tried that as well to check.
The results where a mix of the following 3.

The empty strings are mostly from type 2 ( data bound parameter).

In that case i guess i would need to use other ways ie like the GetField() method and get the parameter value?

Hi

try to use this method for parameter values