Nested Line Items

Add hierarchical data to your documents with up to 3 levels of nesting - perfect for invoices with services and tasks, bills of materials, or any parent-child-grandchild data structure.

Overview

Nested line items allow you to display hierarchical data from linked tables in your documents. Instead of a flat list, you can show:

1    Web Development Package     $2,500
1.1    Frontend Design
1.1.1    React Components
1.1.2    CSS Styling
1.2    Backend API
2    Consulting Services         $1,200
2.1    Strategy Session

Supported levels:

  • Level 1 (Parent): Main items from your line items table

  • Level 2 (Child): Items from a linked table within Level 1

  • Level 3 (Grandchild): Items from a linked table within Level 2


Prerequisites

Before using nested line items, ensure your data source has linked tables set up:

Data Source
Requirement

Airtable

Linked record fields connecting your tables


Placeholder Format

Each nesting level uses a specific placeholder prefix:

Level
Prefix
Example

Level 1 (Parent)

{{line_items_N}}

{{line_items_1}}{{product_name}}

Level 2 (Child)

{{line_items_N_1}}

{{line_items_1_1}}{{component}}

Level 3 (Grandchild)

{{line_items_N_2}}

{{line_items_1_2}}{{specification}}

Where N is the line item table number (1, 2, 3, etc.).

Example Template Structure

┌─────────────────────────────────────────────────────────┐
│ Service              │ Description      │ Price         │  ← Header row
├─────────────────────────────────────────────────────────┤
│ {{line_items_1}}{{service}} │ {{description}} │ {{price}} │  ← Level 1
├─────────────────────────────────────────────────────────┤
│ {{line_items_1_1}}{{task}}  │ {{hours}}       │           │  ← Level 2
├─────────────────────────────────────────────────────────┤
│ {{line_items_1_2}}{{detail}} │                │           │  ← Level 3
└─────────────────────────────────────────────────────────┘

Setting Up Nested Line Items

Step 1: Configure Your Data Source

For Airtable

  1. Navigate to your automation settings

  2. Under Line Items, select your primary linked field (Level 1)

  3. Click "+ Add Level 2" to select a linked field from your Level 1 table

  4. Click "+ Add Level 3" to select a linked field from your Level 2 table

The UI shows a hierarchical view of your linked tables:

Line Items
└── Services (Level 1)
    └── Tasks (Level 2)
        └── Specifications (Level 3)

Step 2: Create Your Template

Using the Template Editor

  1. Open your Google Doc template in DocsAutomator

  2. Click "Add Line Items" in the sidebar

  3. Configure Level 1 (Parent) columns:

    • Add column names and headers

    • Example: service_name, description, price

  4. Click "+ Add Nested Level" for Level 2

  5. Configure Level 2 (Child) columns:

    • Example: task_name, hours

  6. Click "+ Add Nested Level" for Level 3 (optional)

  7. Click "Add Line Items" to insert the table

Manual Template Creation

You can also create the template table manually in Google Docs:

  1. Insert a table with your desired columns

  2. Add header row (optional)

  3. Add one row per nesting level with the appropriate placeholders


Different Column Counts Per Level

Each nesting level can have a different number of columns. DocsAutomator automatically handles this by merging cells when a nested row has fewer columns than its parent.

Example:

  • Level 1: 5 columns (Product, SKU, Category, Qty, Price)

  • Level 2: 3 columns (Component, Size, Material)

  • Level 3: 2 columns (Spec Name, Spec Value)

The Level 2 and Level 3 rows will have their last cells merged to span the remaining columns.


Auto-Numbering with Nested Items

When you enable auto-numbering with nested line items, DocsAutomator generates hierarchical numbers automatically:

1      Product A
1.1      Component 1
1.1.1      Specification A
1.1.2      Specification B
1.2      Component 2
2      Product B
2.1      Component 3
2.1.1      Specification C

To enable auto-numbering:

  1. Toggle "Add auto row numbers" in your line item settings

  2. Configure width and alignment as needed


Sorting Nested Line Items

You can configure sorting independently for each nesting level:

  1. In your automation settings, find the Sorting section

  2. Select a field to sort by for Level 1

  3. Choose ascending or descending order

  4. Repeat for Level 2 and Level 3

Smart sort labels help you understand the sort behavior:

  • Numbers: "1 → 9" or "9 → 1"

  • Dates: "Oldest first" or "Newest first"

  • Text: "A → Z" or "Z → A"

  • Checkboxes: "Unchecked first" or "Checked first"


Use Cases

Invoice with Services and Tasks

Airtable Structure:
Invoices → Services (linked) → Tasks (linked)

Template:
{{line_items_1}}{{service_name}}  |  {{line_items_1}}{{rate}}
{{line_items_1_1}}{{task_name}}   |  {{line_items_1_1}}{{hours}}

Bill of Materials (BOM)

Airtable Structure:
Products → Components (linked) → Parts (linked)

Template:
{{line_items_1}}{{assembly}}      |  {{qty}}  |  {{cost}}
{{line_items_1_1}}{{component}}   |  {{qty}}  |  {{cost}}
{{line_items_1_2}}{{part_number}} |  {{qty}}  |  {{cost}}

Project Report

Airtable Structure:
Projects → Phases (linked) → Milestones (linked)

Template:
{{line_items_1}}{{phase_name}}        |  {{status}}  |  {{due_date}}
{{line_items_1_1}}{{milestone}}       |  {{status}}  |  {{due_date}}
{{line_items_1_2}}{{deliverable}}     |  {{status}}  |

Best Practices

  1. Use views for sorting: Create sorted views in Airtable and select them in DocsAutomator for consistent ordering

  2. Test with small datasets first: Verify your template works correctly with a few records before generating large batches

  3. Consider column alignment: Design your template so nested rows align logically with parent rows

  4. Use meaningful field names: Clear placeholder names make templates easier to maintain


Troubleshooting

Nested rows not appearing

  • Verify linked record fields have data

  • Check that Level 2/3 linked fields are selected in DocsAutomator

  • Ensure placeholders use correct prefix (_1 for Level 2, _2 for Level 3)

Wrong nesting order

  • Check your Airtable view sorting

  • Configure sorting in DocsAutomator's line item settings

Merged cells not aligning

  • Ensure your template table has the correct number of columns

  • Verify that each level's placeholders are in separate rows


Last updated