Set Cell Value in Panel Schedule

Hello. I am trying to use Excel to populate a panel schedule in Revit using API/Python and am confused by this error I am receiving:

Exception: Parameter not found for this cell
Parameter name: nLogRow, nLogCol

Dynamo:


Revit Panel Schedule:

Here is the python:

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
# Import RevitNodes
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
# Import DocumentManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

# The inputs to this node will be stored as a list in the IN variables.
panelschedule = UnwrapElement(IN[0][0])
excelsheet = IN[1]
headers = excelsheet.pop(0)
fulldata = excelsheet

for rowInd, rowData in enumerate(fulldata):
    for colInd, cellData in enumerate(rowData):
        panelschedule.SetParamValue(SectionType.Body,rowInd + 1,colInd + 1, cellData)

OUT = "success";

Any help would be appreciated. This is done in Revit 2017 and Dynamo 2.0.2. Unfortunately I cannot upload the Revit or Excel file.

Thank you.

I think I figured it out. I can’t set the cell text this way, I have to access the schedule’s TableSectionData and its SetCellText method.

Fixed it. Here is the final Python:

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
# Import RevitNodes
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
# Import DocumentManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

# The inputs to this node will be stored as a list in the IN variables.
panelschedule = UnwrapElement(IN[0][0])
tabledata = panelschedule.GetSectionData(SectionType.Body)
excelsheet = IN[1]
headers = excelsheet.pop(0)
fulldata = excelsheet

TransactionManager.Instance.EnsureInTransaction(doc)
for rowInd, rowData in enumerate(fulldata):
    for colInd, cellData in enumerate(rowData):
        tabledata.SetCellText(rowInd + 2, colInd + 1, cellData)
TransactionManager.Instance.TransactionTaskDone()

OUT = 'success'
2 Likes