Objectives
Automatically generate a PDF invoice from SharePoint list data and send it to the customer via email when a new invoice is created.
Use Case Scenarios
You maintain an Invoices list in SharePoint and every time a new invoice is added to this list, a PDF is generated and emailed to the customer.
Step-by-Step Process
Step 1: Create the SharePoint List
Create a list named Invoices with the following columns:
| Column Name | Type |
| Title | Single line of text |
| CustomerName | Single line of text |
| Single line of text | |
| InvoiceDate | Date only |
| ItemDescription | Multi lines of text |
| Quantity | Number |
| UnitPrice | Currency |
| TotalAmount | Currency |
Step 2: Create the Power Automate Flow
- Trigger: When an Item is Created

- Compose HTML Invoice: Add a Compose action with the following HTML content:
<html>
<head>
<style>
body { font-family: Arial; padding: 20px; }
h2 { color: #2E86C1; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
</style>
</head>
<body>
<h2>Invoice #: @{triggerOutputs()?['body/Title']}</h2>
<p><strong>Date:</strong> @{triggerOutputs()?['body/InvoiceDate']}</p>
<p><strong>Customer:</strong> @{triggerOutputs()?['body/CustomerName']}</p>
<p><strong>Email:</strong> @{triggerOutputs()?['body/Email']}</p>
<h3>Invoice Details</h3>
<table>
<tr><th>Description</th><th>Quantity</th><th>Unit Price</th><th>Total</th></tr>
<tr>
<td>@{triggerOutputs()?['body/ItemDescription']}</td>
<td>@{triggerOutputs()?['body/Quantity']}</td>
<td>@{triggerOutputs()?['body/UnitPrice']}</td>
<td>@{triggerOutputs()?['body/TotalAmount']}</td>
</tr>
</table>
<p><strong>Total Amount:</strong> ₹@{triggerOutputs()?['body/TotalAmount']}</p>
</body>
</html>

- Create HTML File in OneDrive
Action: Create file (OneDrive for Business)
Folder Path: /Invoices
File Name: Invoice Title (Dynamic value from SharePoint).html
File Content: Output of the Compose action

- Convert HTML to PDF
Action: Convert File
File: Use Id of the file created in the previous step
Type: PDF

- Send Email with PDF Attachment

Final Output: Whenever an invoice is added to the SharePoint list, the flow will:
- Generate a formatted PDF from the list data.
- Attach the PDF in an email.
- Send it to the customer instantly.

Conclusion:
With Power Automate, creating and sending invoices is quick and easy. Once set up, this flow will automatically generate a PDF invoice and email it to your customer whenever a new entry is added to your SharePoint list.