# QuickBooks Online

## Creating an invoice with a variable number of line items

A common use-case is that you might want to create an invoice in QuickBooks Online populated from a list of items in other data sources (for example, from a number of rows in a spreadsheet).

Setting this up requires a few extra steps, namely:

* Creating the line items for each input using an iterator
* Unrolling the list of line items from the iterator into the invoice creation

As an example, consider the following spreadsheet containing rows, where each row represents an invoice line item:

<figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-50cf922e22378b6d2f59cabdc85d73ae458df127%2Fimage.png?alt=media" alt="Spreadsheet showing invoice line items with columns for Item, Description, Quantity, and Rate to be used in QuickBooks invoice creation"><figcaption></figcaption></figure>

To populate line items from this spreadsheet, we would first retrieve a list of the spreadsheet rows, using a find step:

<figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-f7d0b110ad2ef6a9f38807da453cdfbb6ad0b2eb%2Fimage.png?alt=media" alt="Relay.app Google Sheets Find step configuration showing selection of rows from the spreadsheet to retrieve invoice line item data"><figcaption></figcaption></figure>

Next, we would use an iterator, along with a quickbooks **Create Invoice Line Item** step to create a list of line-items:

<figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-1ef6695f31537f4e6eeed3fed1b996bcf998f0ed%2Fimage.png?alt=media" alt="Relay.app workflow showing an iterator step connected to QuickBooks Create Invoice Line Item action to process multiple rows"><figcaption></figcaption></figure>

Finally, we can "unroll" the list of line-items to populate the line-items in the **Create invoice** step:

<figure><img src="https://647519108-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkKoEy3xMIYaIwd4mRAB%2Fuploads%2Fgit-blob-5dac32f59a8a26624db0e9a9cb4ae2b023b1306d%2Fimage.png?alt=media" alt="QuickBooks Create invoice step configuration showing line items field populated with unrolled data from the iterator output"><figcaption></figcaption></figure>
