n8nflow.net logo

Fetch Odoo Customer Data and Export to JSON or Excel

by V3 Code StudioUpdated: Last update 5 days agoSource: n8n.io
Loading workflow viewer...

Tags

Getting Started

<p><strong>Odoo Customers API – Export to JSON or Excel</strong> provides a simple way to fetch customer records from your Odoo database and get them back either as a structured JSON response or a downloadable Excel (.xlsx) file.</p> <h3>⚙️ What it does</h3> <ul> <li>Listens for HTTP <code>GET</code> requests on the endpoint <code>/api/v1/get-customers</code>.</li> <li>Checks for the required <code>name</code> parameter and builds a search filter automatically.</li> <li>Queries the <code>res.partner</code> model to return only customer contacts (<code>is_company = false</code>).</li> <li>Delivers results in <strong>JSON</strong> by default, or as an <strong>Excel (.xlsx)</strong> export when <code>response_format=excel</code> is included.</li> </ul> <h3>📥 Parameters</h3> <ul> <li><code>name</code> — Required. Used for partial matching on customer names (via Odoo’s <code>Like</code> filter).</li> <li><code>response_format</code> — Optional. Accepts <code>json</code> (default) or <code>excel</code>.</li> </ul> <h3>🔗 Examples</h3> <h5>Excel Example</h3> <pre><code>GET /api/v1/get-customers?name=Demo&response_format=excel</code></pre> <h5>JSON Example</h3> <pre><code>GET /api/v1/get-customers?name=Demo&response_format=json</code></pre> <h3>🧩 Default fields</h3> <p><code>display_name, name, email, phone, mobile, parent_id, company_id, country_code, country_id</code></p> <h3>🛠️ Setup</h3> <ul> <li>Open the Odoo node and connect your Odoo API credentials.</li> <li>Adjust the <strong>fieldsList</strong> in the node if you want to include more data fields (e.g., address, city, or VAT).</li> <li>Trigger the flow from its webhook URL or run it manually inside n8n to test the output.</li> </ul> <h3>💡 Notes</h3> <ul> <li>Built and tested for <strong>n8n v1.108.2+</strong></li> </ul>