Schema Export
Export your DealCloud schema to Excel for documentation, analysis, or sharing.
export_schema_to_excel()
Creates a comprehensive Excel workbook with schema documentation:
from dealcloud_sdk import DealCloud, DealCloudConfig
config = DealCloudConfig(
siteUrl="yoursite.dealcloud.com",
clientId=12345,
clientSecret="your-secret",
)
dc = DealCloud.from_config_object(config)
# Export full schema
path = dc.export_schema_to_excel("schema_export.xlsx")
print(f"Exported to: {path}")Output Format
The Excel file contains multiple sheets:
| Sheet | Contents |
|---|---|
| Objects | All objects with IDs, names, types |
| Fields | All fields with types, properties, references |
| Choice Values | Choice field options (optional) |
| Relationships | Reference field mappings (optional) |
Objects Sheet
| Column | Description |
|---|---|
| Object ID | Unique object ID |
| Object Name | Display name |
| API Name | API name (for code) |
| Singular Name | Singular display name |
| Plural Name | Plural display name |
| Entry List Type | Object type category |
Fields Sheet
| Column | Description |
|---|---|
| Object Name | Parent object |
| Field ID | Unique field ID |
| Field Name | Display name |
| API Name | API name (for code) |
| Field Type ID | Type ID |
| Field Type Name | Type name |
| Is Required | Required flag |
| Is Multi-Select | Multi-select flag |
| Is Calculated | Calculated flag |
| Reference Objects | Target objects (references) |
| Description | Field description |
Choice Values Sheet
| Column | Description |
|---|---|
| Object Name | Parent object |
| Field Name | Parent field |
| Field API Name | Field API name |
| Choice ID | Choice value ID |
| Choice Name | Choice display name |
| Parent ID | Parent choice (hierarchical) |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
filepath | str | Path | Required | Output .xlsx path |
objects | List[str] | None | All objects | Optional list of object API names to include |
include_summary | bool | True | Include summary sheet |
include_relationships | bool | True | Include relationships sheet |
The workbook layout (summary, per-object sheets, relationships) is produced by the SDK implementation of export_schema_to_excel() in dealcloud_sdk, not the legacy parameter names output_path / include_choice_values.
Examples
Full Export
# Export everything
dc.export_schema_to_excel("full_schema.xlsx")Selected Objects
# Export specific objects only
dc.export_schema_to_excel(
"crm_schema.xlsx",
objects=["Company", "Contact", "Deal", "Interaction"]
)Toggle summary or relationships sheets
# Summary only, skip relationships sheet
dc.export_schema_to_excel(
"schema_no_rel.xlsx",
include_summary=True,
include_relationships=False,
)Minimal path export
dc.export_schema_to_excel("schema_minimal.xlsx")Use Cases
Documentation
# Generate schema documentation for a new project
dc.export_schema_to_excel(
f"schema_{dc.site_url.split('.')[0]}_{datetime.now():%Y%m%d}.xlsx",
)Compare Environments
# Export from multiple environments
for env in ["prod", "staging", "dev"]:
dc = DealCloud.from_json(f"config_{env}.json")
dc.export_schema_to_excel(f"schema_{env}.xlsx")
# Then compare Excel files manually or programmaticallyData Dictionary
from pathlib import Path
def create_data_dictionary(dc, output_dir: str):
"""Create comprehensive data dictionary."""
output = Path(output_dir)
output.mkdir(exist_ok=True)
# Full schema
dc.export_schema_to_excel(output / "full_schema.xlsx")
# Per-object exports
objects = dc.get_objects()
for obj in objects:
dc.export_schema_to_excel(
output / f"{obj.apiName}_schema.xlsx",
objects=[obj.apiName]
)
print(f"Created data dictionary in {output}")
create_data_dictionary(dc, "./data_dictionary")Integration Mapping
def create_integration_map(dc, target_system_fields: dict, output_path: str):
"""
Create mapping document between DealCloud and external system.
target_system_fields: Dict of {dc_api_name: external_field_name}
"""
import pandas as pd
schema = dc.get_schema()
mapping = []
for obj_name, obj_data in schema.objects.items():
for field_name, field in obj_data.fields.items():
external = target_system_fields.get(f"{obj_name}.{field_name}")
mapping.append({
"DC Object": obj_name,
"DC Field": field_name,
"DC Display": field.name,
"DC Type": field.fieldType,
"External Field": external or "",
"Mapped": "Yes" if external else "No"
})
df = pd.DataFrame(mapping)
df.to_excel(output_path, index=False)
# Usage
field_map = {
"Company.CompanyName": "account_name",
"Company.Industry": "industry_code",
"Contact.Email": "email_address",
}
create_integration_map(dc, field_map, "integration_mapping.xlsx")Custom Export
For custom formats, use get_schema() directly:
import pandas as pd
def custom_schema_export(dc, output_path: str):
"""Custom schema export with specific formatting."""
schema = dc.get_schema()
with pd.ExcelWriter(output_path, engine='openpyxl') as writer:
# Custom objects sheet
objects_data = []
for name, obj in schema.objects.items():
objects_data.append({
"API Name": name,
"Display Name": obj.object.pluralName,
"Field Count": len(obj.fields),
"Has Attachments": any(f.isAttachment for f in obj.fields.values())
})
pd.DataFrame(objects_data).to_excel(writer, sheet_name="Objects", index=False)
# Custom fields sheet per object
for name, obj in schema.objects.items():
if len(obj.fields) > 0:
fields_data = [
{
"API Name": f.apiName,
"Display": f.name,
"Type": f.fieldType,
"Required": "✓" if f.isRequired else "",
}
for f in obj.fields.values()
]
pd.DataFrame(fields_data).to_excel(
writer,
sheet_name=name[:31], # Excel sheet name limit
index=False
)
custom_schema_export(dc, "custom_schema.xlsx")Related
- Objects - Object metadata
- Fields - Field metadata
- Metadata Types - Field type reference
- Utilities & helpers - Generic Excel helpers (
export_to_excel, …); this page covers schema workbook export only