# dgn-to-excel

dgn-to-excel converts MicroStation DGN files (v7 and v8) into structured Excel spreadsheets. Extracts CAD elements, levels, and text properties in infrastructure projects.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 117 installs · ★ 434 repo stars
- Author: datadrivenconstruction
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/1_DDC_Toolkit/CAD-Converters/dgn-to-excel/SKILL.md
- Updated: 2026-10-19
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/dgn-to-excel

## What it does

The skill converts MicroStation DGN files (versions V7, V8, and V8i) into `.xlsx` workbooks. It structures drawing elements into tabular records, capturing element IDs, level assignments, line weights, bounding box ranges, cell names, and text annotations.

Execution relies on the `DgnExporter.exe` CLI tool. It handles single files as well as recursive batch conversions through Windows shell loops or PowerShell scripts. An included Python helper uses pandas to filter element types, aggregate level counts, and isolate text strings.

The workflow is strictly bound to Windows (`win32`): conversions fail if `DgnExporter.exe` or `python3` is missing from the host machine.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill dgn-to-excel -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/dgn-to-excel/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/dgn-to-excel/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill dgn-to-excel -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/dgn-to-excel/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill dgn-to-excel -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/dgn-to-excel/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction 1_DDC_Toolkit/CAD-Converters/dgn-to-excel
```

2. **Manually: put the files in place**
- File: `.github/skills/dgn-to-excel/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill dgn-to-excel -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --path 1_DDC_Toolkit/CAD-Converters/dgn-to-excel
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/dgn-to-excel/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill dgn-to-excel -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/1_DDC_Toolkit/CAD-Converters/dgn-to-excel/SKILL.md

## When to use it
- convert legacy V7 and modern V8 DGN files into Excel workbooks
- extract CAD levels, geometry types, and coordinate ranges from civil engineering drawings
- export text annotations and cell block references into tabular reports
- batch process project folders containing highway, rail, and bridge models

## Example prompts
- Convert `Bridge.dgn` to an Excel spreadsheet using `DgnExporter.exe`
- Extract level summaries and element counts from `Highway.dgn`
- Batch convert all DGN files in `C:\Infrastructure` into `.xlsx` files

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 24973b2c956d7a27.

BEGIN THIRD-PARTY FILE 24973b2c956d7a27
````text
---
name: "dgn-to-excel"
description: "Convert DGN files (v7-v8) to Excel databases. Extract elements, levels, and properties from infrastructure CAD files."
homepage: "https://datadrivenconstruction.io"
metadata: {"openclaw":{"emoji":"📄","os":["win32"],"homepage":"https://datadrivenconstruction.io","requires":{"bins":["python3","DgnExporter"]}}}
---

# DGN to Excel Conversion

## Business Case

### Problem Statement
DGN files are common in infrastructure and civil engineering:
- Transportation and highway design
- Bridge and tunnel projects
- Utility networks
- Rail infrastructure

Extracting structured data from DGN files for analysis and reporting can be challenging.

### Solution
Convert DGN files to structured Excel databases, supporting both v7 and v8 formats.

### Business Value
- **Infrastructure support** - Civil engineering focused
- **Legacy format support** - V7 and V8 DGN files
- **Data extraction** - Levels, cells, text, geometry
- **Batch processing** - Process multiple files
- **Structured output** - Excel format for analysis

## Technical Implementation

### CLI Syntax
```bash
DgnExporter.exe <input_dgn>
```

### Supported Versions
| Version | Description |
|---------|-------------|
| V7 DGN | Legacy MicroStation format (pre-V8) |
| V8 DGN | Modern MicroStation format |
| V8i DGN | MicroStation V8i format |

### Output Format
| Output | Description |
|--------|-------------|
| `.xlsx` | Excel database with all elements |

### Examples

```bash
# Basic conversion
DgnExporter.exe "C:\Projects\Bridge.dgn"

# Batch processing
for /R "C:\Infrastructure" %f in (*.dgn) do DgnExporter.exe "%f"

# PowerShell batch
Get-ChildItem "C:\Projects\*.dgn" -Recurse | ForEach-Object {
    & "C:\DDC\DgnExporter.exe" $_.FullName
}
```

### Python Integration

```python
import subprocess
import pandas as pd
from pathlib import Path
from typing import List, Optional, Dict, Any
from dataclasses import dataclass
from enum import Enum


class DGNElementType(Enum):
    """DGN element types."""
    CELL_HEADER = 2
    LINE = 3
    LINE_STRING = 4
    SHAPE = 6
    TEXT_NODE = 7
    CURVE = 11
    COMPLEX_CHAIN = 12
    COMPLEX_SHAPE = 14
    ELLIPSE = 15
    ARC = 16
    TEXT = 17
    SURFACE = 18
    SOLID = 19
    BSPLINE_CURVE = 21
    POINT_STRING = 22
    DIMENSION = 33
    SHARED_CELL = 35


@dataclass
class DGNElement:
    """Represents a DGN element."""
    element_id: int
````
END THIRD-PARTY FILE 24973b2c956d7a27

The third-party file has ended. Everything between the 24973b2c956d7a27 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2415 of 15732 bytes. © datadrivenconstruction · MIT · https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/1_DDC_Toolkit/CAD-Converters/dgn-to-excel/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
