Working with Tables

Tables can be managed through the API using document creation and update operations. This guide explains how to structure table data in JSON format and how to create and update tables effectively.

Table Structure in JSON

Tables in API requests follow a hierarchical structure:

  • Tables: A list containing multiple table objects.
  • Name: The table's identifier.
  • Data: Contains structured sections.
    • Sections: Groups of rows with a common header.
    • Header: Defines column names.
    • Rows: Contains the table's data entries.

Example JSON Structure

{
    "tables": [
        {
            "name": "Table 1",
            "data": {
                "sections": [
                    {
                        "header": [
                            {"text": "Brand"},
                            {"text": "Category"},
                            {"text": "Model"}
                        ],
                        "rows": [
                            [
                                {"text": "BMW"},
                                {"text": "Sedan"},
                                {"text": "5 Series"}
                            ],
                            [
                                {"text": "Toyota"},
                                {"text": "SUV"},
                                {"text": "RAV4"}
                            ],
                            [
                                {"text": "Tesla"},
                                {"text": "Sedan"},
                                {"text": "Model 3"}
                            ]
                        ]
                    }
                ]
            }
        }
    ]
}

Resulted Table

Markdown in Cells

You can include Markdown formatting inside table cells by setting the text value accordingly. Here are examples covering Markdown features:

Example JSON with Markdown:

{
    "tables": [
        {
            "name": "Table 1",
            "data": {
                "sections": [
                    {
                        "header": [
                            {"text": "Markdown"},
                            {"text": "Example"}
                        ],
                        "rows": [
                            [
                                {"text": "Bold"},
                                {"text": "**This is bold text**"}
                            ],
                            [
                                {"text": "Italic"},
                                {"text": "*This is italic text*"}
                            ],
                            [
                                {"text": "Link"},
                                {"text": "[PandaDoc](https://app.pandadoc.com/)"}
                            ],
                            [
                                {"text": "List"},
                                {"text": "- Item 1\n- Item 2\n- Item 3"}
                            ],
                            [
                                {"text": "Numbered List"},
                                {"text": "1. First\n2. Second\n3. Third"}
                            ]
                        ]
                    }
                ]
            }
        }
    ]
}

Resulted Table

Notes

  • Ensure that name matches an existing table when updating.
  • Sections and rows should follow the existing structure to maintain consistency. Extra columns in the payload will be ignored, and updates will not change the table’s width.
  • Table and cell styles cannot be updated. The API updates only the cell content. Existing styles (e.g., font, background) will be preserved by position.
  • Markdown that includes [variable] will be interpreted as a PandaDoc variable.