Pyrevit and excel

@aaronrumple Thanks for the feedback.
I adjusted my code to be more in line with yours, and now it works, but I find that kind of weird.

  1. Since I can’t seem to find the Schedule.GetCellText() in the API docs.
  2. Also, the code that I used before, TableSectionData.GetCellText(), did the trick just fine with other code that we have in C#.

As I said, weird. But hey, the problem is solved, and it seems to work fine now.
I will try some further testing since I also need to know which parameters are adjustable and which are not. But as you said, that could be derived from the CellType, probably.

i’ll post my finding here for the community.

Documented here:

…and a schedule is TableView. Just one of those goofy Revit things,

I’m guessing hat the C# was calling the wrong item and maybe had some overloads. Would have to see the code.

https://www.revitapidocs.com/2024/

…and a new kid on the block:
https://revapidocs.com/

1 Like

if only that our company firewall didn’t block acces to: :stuck_out_tongue:
https://revapidocs.com/

But my bad for looking over the other version of GetCellText.

@aaronrumple:
Have you succeeded in retrieving the elements ( or elementtypes) listed in the schedules?

when i use:
elements = FilteredElementCollector(doc, schedule.Id).WhereElementIsNotElementType().ToElements()

I get a lot more elements then the onces int he schedule.

Is “Itemize every instance” unchecked in Sorting/Grouping?
That would do it. Those items would really be there - just grouped together. You can use the Count parameter on the schedule to see how many are in each group

I need to be able to cover both cases itemized and non-itemized schedules.
i’m thinking of introducing a parameter and drop the id’s in it and the temporaly adding it to the schedules to read them out and then roll back that transaction.

tha way it would just be a parameter read-out but it would use a lot of processing i fear and slow the scripts alot.

on the internet i also found these topics:
Solved: Get elements from schedule - Autodesk Community

Solved: Quick way of counting rows in a schedule? - Autodesk Community

wich also seems to suggets it’s not realy possible to use the methoded i used.

I’d just pull the method for grouping items from the schedule and then apply that to your own list of data. A list of lists. Python is very good at that sort of thing. And it is probably the fastest.
The parameters you need are already there because that is what the sorting and grouping is using…
For export you then just need the first item - item[0] - from each of the grouped lists. Everything in that group is the same. (…more or less. Some parameters may differ, but those aren’t parameters in the schedule.)