Using Spreadsheets as Data Sources

Note
The example reads the shop data described in The Business Layer.

Using Spreadsheets as Data Sources

Following classes are added in GroupDocs.Assembly.Data namespace:

The Recipe

  • Define template and output report documents
  • Assemble a document using the external document table as a data source

Download

Data Source Document

Template

The Code

from groupdocs.assembly import DataSourceInfo, DocumentAssembler
from groupdocs.assembly.data import DocumentTable, DocumentTableOptions

options = DocumentTableOptions()
options.first_row_contains_column_names = True
table = DocumentTable("contracts.xlsx", 0, options)

assembler = DocumentAssembler()
assembler.assemble_document("table-row.docx", "table-row-report.docx", DataSourceInfo(table, "contracts"))

The following sample file is used in this example: table-row.docx

The following sample file is used in this example: contracts.xlsx

Binary file (DOCX, 10 KB)

Download full output

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.