| name | excel-to-rvt |
| description | Import Excel data into RVT projects. Update element parameters, create schedules, and sync external data sources. |
| homepage | https://datadrivenconstruction.io |
| metadata | {"openclaw":{"emoji":"📄","os":["win32"],"homepage":"https://datadrivenconstruction.io","requires":{"bins":["python3"]}}} |
Excel to RVT Import
Note: RVT is the file format. Examples may reference Autodesk® Revit® APIs. Autodesk and Revit are registered trademarks of Autodesk, Inc.
Business Case
Problem Statement
External data (costs, specifications, classifications) lives in Excel but needs to update Revit:
- Cost estimates need to link to model elements
- Classification codes need assignment
- Custom parameters need population
- Manual entry is slow and error-prone
Solution
Automated import of Excel data into Revit using the DDC ImportExcelToRevit tool and Dynamo workflows.
Business Value
- Automation - Batch update thousands of parameters
- Accuracy - Eliminate manual data entry errors
- Sync - Keep external data in sync with model
- Flexibility - Update any writable parameter
Technical Implementation
Methods
- ImportExcelToRevit CLI - Direct command-line update
- Dynamo Script - Visual programming approach
- Revit API - Full programmatic control
ImportExcelToRevit CLI
ImportExcelToRevit.exe <model.rvt> <data.xlsx> [options]
| Option | Description |
|---|
-sheet | Excel sheet name |
-idcol | Element ID column |
-mapping | Parameter mapping file |
Python Implementation
import subprocess
import pandas as pd
from pathlib import Path
from typing import Dict, Any, List, Optional, Tuple
from dataclasses import dataclass
import json
@dataclass
class ImportResult:
"""Result of Excel import to Revit."""
elements_processed: int
elements_updated: int
elements_failed: int
parameters_updated: int
errors: List[str]
class ExcelToRevitImporter:
"""Import Excel data into Revit models."""
def __init__(self, tool_path: str = "ImportExcelToRevit.exe"):
self.tool_path = Path(tool_path)
def import_data(self, revit_file: str,
excel_file: str,
sheet_name: str = "Elements",
id_column: str = "ElementId",
parameter_mapping: Dict[str, str] = None) -> ImportResult:
"""Import Excel data into Revit."""
cmd = [
(.tool_path),
revit_file,
excel_file,
, sheet_name,
, id_column
]
parameter_mapping:
mapping_file = ._create_mapping_file(parameter_mapping)
cmd.extend([, mapping_file])
result = subprocess.run(cmd, capture_output=, text=)
._parse_result(result)
() -> :
mapping_path = Path()
(mapping_path, ) f:
json.dump(mapping, f)
(mapping_path)
() -> ImportResult:
result.returncode == :
ImportResult(
elements_processed=,
elements_updated=,
elements_failed=,
parameters_updated=,
errors=[]
)
:
ImportResult(
elements_processed=,
elements_updated=,
elements_failed=,
parameters_updated=,
errors=[result.stderr]
)
:
() -> :
mappings_json = json.dumps(mappings)
script =
(output_path, ) f:
f.write(script)
output_path
() -> :
fields_json = json.dumps(fields)
script =
(output_path, ) f:
f.write(script)
output_path
:
():
.revit_data = revit_elements
.valid_ids = (revit_elements[].astype().tolist())
() -> [, ]:
results = {
: ,
: (import_df),
: ,
: [],
: [],
: []
}
import_ids = import_df[id_column].astype().tolist()
import_id import_ids:
import_id .valid_ids:
results[] +=
:
results[].append(import_id)
results[]:
results[] =
results[].append(
)
results[] = (
results[] / results[] * ,
) results[] >
results
() -> []:
errors = []
column, expected_type type_definitions.items():
column import_df.columns:
idx, value import_df[column].items():
pd.isna(value):
expected_type == :
:
(value)
ValueError:
errors.append()
expected_type == :
:
(value)
ValueError:
errors.append()
errors
Quick Start
generator = DynamoScriptGenerator()
mappings = {
'OmniClass_Code': 'OmniClass Number',
'Unit_Cost': 'Cost',
'Material_Type': 'Material'
}
generator.generate_parameter_update_script(
mappings=mappings,
excel_path="enriched_data.xlsx",
output_path="update_revit.py"
)
Validation
validator = ExcelDataValidator(revit_export_df)
validation = validator.validate_import_data(import_df)
if validation['valid']:
print(f"Ready to import. Match rate: {validation['match_rate']}%")
else:
print(f"Issues found: {validation['warnings']}")
Complete Workflow
revit_df = pd.read_excel("model.xlsx")
validator = ExcelDataValidator(revit_df)
import_df = pd.read_excel("enriched_data.xlsx")
validation = validator.validate_import_data(import_df)
if validation['valid']:
generator = DynamoScriptGenerator()
generator.generate_parameter_update_script(
mappings={'Classification': 'OmniClass Number'},
excel_path="enriched_data.xlsx",
output_path="apply_updates.py"
)
print("Run apply_updates.py in Dynamo to update Revit")
Resources