# Extract All Content from an Excel File (including text boxes)

**URL:** <https://forum.dynamobim.com/t/extract-all-content-from-an-excel-file-including-text-boxes/109798>\
**Category:** Uncategorized\
**Tags:** python, dynamo\
**Created:** [April 29, 2025, 1:28pm UTC](https://forum.dynamobim.com/t/extract-all-content-from-an-excel-file-including-text-boxes/109798 "2025-04-29T13:28:08Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [May 1, 2025, 2:53am UTC](https://forum.dynamobim.com/t/extract-all-content-from-an-excel-file-including-text-boxes/109798/6 "2025-05-01T02:53:44Z")

</div>

You can use `xlwings` library which runs excel in the background and gives access to the Excel VBA API

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/3/533e26514277c078548cc9b860b5eaf48d42e8f2.png)

Code extracts the text from all text boxes

```python
import xlwings as xw

def get_text(shape):
    text = []
    if shape.Type == 6:
        for item in shape.GroupItems:
            text.extend(get_text(item))
    elif shape.Type == 17:
        text.append(shape.TextFrame2.TextRange.Text)

    return text

excel_file = IN[0]
with xw.App(visible=False) as app:
    wb = xw.Book(excel_file)
    output = {}
    for sheet in wb.api.Sheets:
        for shp in sheet.Shapes:
            output.setdefault(sheet.Name, []).append(get_text(shp))

OUT = output

```

My post on installing python libraries to Dynamo

> [@Openpyxl module](https://forum.dynamobim.com/t/openpyxl-module/94081/5):
>
> It looks like you have it installed on a python instance (3.11) that is not being used by Dynamo You can find the install location OUT = sys.path which will return a few paths C:\Users\\<username\>\AppData\Local\python-3.8.3-embed-amd64\python38.zip, C:\Users\\<username\>\AppData\Local\python-3.8.3-embed-amd64, C:\Users\\<username\>\AppData\Local\python-3.8.3-embed-amd64\lib\site-packages pip is not always the easiest module to install with Dynamo Try this in a Python node with CPython3 import su…

---

_[View the full topic](https://forum.dynamobim.com/t/extract-all-content-from-an-excel-file-including-text-boxes/109798)._
