GroupDocs.Assembly for Python via .NET Overview

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Assembly MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-assembly -- dnx GroupDocs.Assembly.Mcp --yes
Folders, licensing and more →

What is GroupDocs.Assembly?

GroupDocs.Assembly for Python via .NET is a native Python library for document automation: it builds reports and documents from templates. A template is an ordinary Word, Excel, PowerPoint, OpenDocument, email, HTML, Markdown or text document in which tags such as <<[customer.Name]>> and <<foreach [o in orders]>> mark where the data goes. GroupDocs.Assembly fills the tags with your data - Python dicts and lists, JSON, XML and CSV files, or the tables of other documents - and saves the report in the template’s format or another one, such as PDF. No Microsoft Office installation is required.

Typical uses include:

  • Business documents - invoices, contracts, offers and letters from one template per document type.
  • Reports - tables, lists and charts of sales, orders or any other data, with totals, grouping, filtering and sorting done in the template.
  • Email - messages whose recipients, subject and body come from data.
  • Mail merge - one document per customer, employee or record.

Key Capabilities

CapabilityDescription
Python dataDicts and lists as they are, with their types: numbers, strings, dates, Decimal, nested dicts and lists.
Data files and documentsJSON, XML and CSV files, and the tables of Word, Excel and PowerPoint documents.
Template syntaxExpressions, formatting and data bands, with Sum, Where, GroupBy, OrderBy and other sequence operations in the template.
Tables and listsTable reports with totals, master-detail, highlighting and merged cells, and bulleted and numbered lists.
ChartsPie, bubble, scatter and column charts with series, points and colors from data.
Images, barcodes, linksImages, barcodes, hyperlinks and bookmarks and whole documents inserted from data.
EmailMSG and EML templates with sender, recipients, subject and body from data.
FormatsMore than 40 template formats, and reports saved to another format such as PDF, HTML or XPS.
On-premiseNo cloud calls, no Microsoft Office install, no network traffic.

Quick Example

Fill a Word template with the orders of a customer from a JSON file, and save the report as PDF:

import json

from groupdocs.assembly import DataSourceInfo, DocumentAssembler

def quick_example():
    # The data: one customer and its orders, read from JSON into a dict
    with open("customer.json", encoding="utf-8") as f:
        customer = json.load(f)

    # Fill the template's tags and save the report as PDF
    assembler = DocumentAssembler()
    assembler.assemble_document("customer-summary.docx", "customer-summary.pdf", DataSourceInfo(customer, "customer"))
    print("Orders in the report:", len(customer["Order"]))

if __name__ == "__main__":
    quick_example()

The following sample file is used in this example: customer-summary.docx

The following sample file is used in this example: customer.json

Binary file (PDF, 37 KB)

Download full output

The template holds the customer’s name and address, a table whose row repeats for each order, and the total:

<<[customer.CustomerName]>>
<<[customer.ShippingAddress]>>, <<[customer.CustomerContactNumber]>>
| Product                                              | Quantity                  | Price, USD                    |
| <<foreach [o in customer.Order]>><<[o.Product.ProductName]>> | <<[o.ProductQuantity]>> | <<[o.Price]>><</foreach>> |
Total: <<[customer.Order.Sum(o => o.Price)]>> USD

Where to next