# Get Sheets From Document

**URL:** <https://forum.dynamobim.com/t/get-sheets-from-document/44549>\
**Category:** Developers\
**Tags:** python\
**Created:** [December 16, 2019, 8:01pm UTC](https://forum.dynamobim.com/t/get-sheets-from-document/44549 "2019-12-16T20:01:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Dunn1](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael\_Dunn1](https://forum.dynamobim.com/u/Michael_Dunn1)\
**Post date:** [December 16, 2019, 8:01pm UTC](https://forum.dynamobim.com/t/get-sheets-from-document/44549/1 "2019-12-16T20:01:29Z")

</div>

Hi - I’m attempting to grab all sheets from a given document. I’ve used a clockwork node that collected all the views as the basis and just changed the class that is collected:

 ![2019-12-17_06h57_46](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/4/64306b339f6ea42b667d5f36894d0614ae4db3f7.png)

```
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

inputdoc = UnwrapElement(IN[1])
if inputdoc == None:
	doc = DocumentManager.Instance.CurrentDBDocument
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.RevitLinkInstance":
	doc = inputdoc.GetLinkDocument()
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.Document":
	doc = inputdoc
else: doc = None

collector = FilteredElementCollector(doc)
views = collector.OfClass(ViewSheet).ToElements()
viewlist = list()
for view in views:
	viewlist.append(view)
OUT = viewlist
```

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [December 16, 2019, 8:13pm UTC](https://forum.dynamobim.com/t/get-sheets-from-document/44549/2 "2019-12-16T20:13:10Z")

</div>

Can you show the inputs for the python node? It is hard to tell what you are inputting and IN[0] isn’t even referenced in the script.

---

<div class="post-metadata">

**Author:** ![Michael\_Dunn1](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael\_Dunn1](https://forum.dynamobim.com/u/Michael_Dunn1)\
**Post date:** [December 16, 2019, 8:35pm UTC](https://forum.dynamobim.com/t/get-sheets-from-document/44549/3 "2019-12-16T20:35:18Z")

</div>

Sure - I’m trying to collect all views and sheets from the document to delete the ones I don’t need to issue. The python is copied from the clockwork node shown.

 ![2019-12-17_07h34_19](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/0/f063c035aadd6424744c1aab511026516faa105b.png)

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [December 16, 2019, 8:51pm UTC](https://forum.dynamobim.com/t/get-sheets-from-document/44549/4 "2019-12-16T20:51:46Z")

</div>

Can you show what the output of Application.OpenDocumentFile is? It might not be Autodesk.Revit.DB.Document, but Revit.Application.Document, which would throw up an error.

---

<div class="post-metadata">

**Author:** ![Michael\_Dunn1](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael\_Dunn1](https://forum.dynamobim.com/u/Michael_Dunn1)\
**Post date:** [December 16, 2019, 9:15pm UTC](https://forum.dynamobim.com/t/get-sheets-from-document/44549/5 "2019-12-16T21:15:08Z")

</div>

Turns out it was sending null - probably because I had been testing too many things and the file was still loaded in memory somewhere. It’s now working so all good.
