As you all know, we at ADN spend a significant amount of our time ensuring that API information is available and easy to find for all.
In order to find something, though, you often need to invest at least a minimum amount of effort in searching.
This can be practiced, of course, and I obtain a useful answer to almost every question I ever have on any subject whatsoever from a single Internet search.
Here are two examples of performing a search for an example of programmatic Revit schedule creation, both desktop and Internet based:
Two Ways to Search for a Schedule Creation Example
Question: I am importing an Excel sheet into a Revit schedule.
How can I add all the fields from the Excel sheet along with the data to the Revit schedule using the Revit API?
Answer: Please excuse me for asking, but this question comes up in my poor little head at almost every query I receive from you: Do you perform any searches for information yourself before submitting a question like this to ADN?
The reason I ask is that I imagine it would save you time, and us as well, of course. We are spending a significant amount of time ensuring that all important API information is publicly available and easily found by the Internet search engines.
Anyway, here is how I approached your question:
- I looked at the Revit API help file RevitAPI.chm. I did not immediately see an answer.
- I opened the SDK sample project SDKSamples2015.sln and searched globally for 'schedule'.
Here is the result of the latter, omitting all but the first hit in each project:
Find all "schedule", Subfolders, Keep modified files open, Find Results 1, Entire Solution, "*.cs" C:\a\lib\revit\2015\SDK\Samples\RoomSchedule\CS\Command.cs(29):namespace Revit.SDK.Samples.RoomSchedule C:\a\lib\revit\2015\SDK\Samples\AllViews\CS\AllViews.cs(185): if (null == objType || objType.Name.Equals("Schedule") C:\a\lib\revit\2015\SDK\Samples\PanelSchedule\CS\CSVTranslator.cs(30):namespace Revit.SDK.Samples.PanelSchedule.CS C:\a\lib\revit\2015\SDK\Samples\RoutingPreferenceTools\CS\RoutingPreferenceBuilder\CommandReadPreferences.cs(38): /// A command to read a routing preference builder xml file and add pipe types, schedules, segments, and sizes, and routing preferences rules to the C:\a\lib\revit\2015\SDK\Samples\ScheduleCreation\CS\Command.cs(33):namespace Revit.SDK.Samples.ScheduleCreation.CS C:\a\lib\revit\2015\SDK\Samples\PostCommandWorkflow\CS\PostCommandRevisionMonitor.cs(154): private void ReactToRevisionsAndSchedulesCommand(object sender, BeforeExecutedEventArgs args) C:\a\lib\revit\2015\SDK\Samples\ScheduleAutomaticFormatter\CS\Application.cs(37):namespace Revit.SDK.Samples.ScheduleAutomaticFormatter.CS C:\a\lib\revit\2015\SDK\Samples\ScheduleToHTML\CS\Application.cs(38):namespace Revit.SDK.Samples.ScheduleToHTML.CS C:\a\lib\revit\2015\SDK\Samples\DuplicateViews\CS\Application.cs(79): pbd2.LongDescription = "Duplicate all duplicatable drafting views and schedules."; Matching lines: 323 Matching files: 35 Total files searched: 989
As you can see, nine SDK samples out of a total of 173 projects deal with schedules in one way or another:
I will leave the rest of this exercise up to you.
As a hint (sorry, I cannot stop myself, I need to check): the entire summary in the readme file of the SDK sample that I recommend you take a look at reads like this:
"Summary: This sample introduces how to create a view schedule and how to show its data on a sheet."
I even tested the sample successfully to make sure it really does what you need using RvtSamples > Views > ScheduleAPI.
The sample makes use of the Revit Schedule API that was introduced in Revit 2013.
The Building Coder even defines an own category for it: Schedule.
That was the desktop oriented approach.
Another, more modern approach that also yields useful results can be encapsulated in one single line and one single click:
Simply google for revit api schedule creation.
You know the story about teaching a man how to fish?
I sincerely hope you do not mind me pointing it out to you so directly.
I even wrote about this topic once before, way back in the very beginnings of The Building Coder, more than five years ago, on creating a group and how to fish.
As the Germans say: Petri Heil!
Piscator non solum piscatur.