Use this powerful n8n workflow template to create a secure API endpoint for fetching Odoo company data, validating inputs, and conditionally exporting results as JSON or Excel (.xlsx).
Download this n8n workflow template and start using it instantly.
This sophisticated n8n workflow establishes a custom API endpoint (/api/v1/get-companies) designed to interface directly with your Odoo instance. It solves the common problem of needing dynamic data extraction where the output format (JSON for system integration or Excel for human review/reporting) must be selectable by the requester.
The core of this n8n automation is its ability to handle required input validation and execute conditional flow control. By utilizing this reusable n8n templates structure, you can ensure that only valid requests proceed to query Odoo, saving resources and ensuring data integrity. This specific n8n workflow demonstrates best practices for building robust internal data services using the n8n platform.
The entire process begins with the designated n8n trigger, which activates upon an incoming HTTP request.
Receive Company Request n8n node acts as the entry point, listening on the specified path for incoming queries.Prepare Dynamic Filter Function n8n node immediately processes the request query parameters. Crucially, it validates that the name parameter is present (used for searching companies). It dynamically prepares the filter criteria for Odoo and determines the required responseformat (defaulting to JSON).Fetch Companies from Odoo Odoo n8n node executes the search against the res.company resource using the prepared filters, retrieving all matching records.Prepare Output Data Function n8n node structures the results, handles null outcomes by returning a failure message, and adds a generation timestamp to the data items.Check If Excel Required If n8n node examines the responseformat variable set earlier. Respond with JSON.Convert to Excel n8n node, which generates a binary XLSX file. The workflow then uses the Respond with File n8n node to send this binary output back to the requester as a downloadable file.Respond with JSON n8n node to return the structured list of company data items.To deploy this powerful n8n workflow template, follow these steps:
Receive Company Request n8n trigger is already configured with the path /api/v1/get-companies and is set to return the data immediately.Fetch Companies from Odoo n8n node. You must set up or link existing Odoo API credentials (including your Odoo URL, API key/password, and database name) to enable the connection. If you plan to use this n8n workflow on a production system, ensure these credentials have appropriate read permissions.fieldsList in the Odoo n8n node settings to add or remove specific company fields (e.g., VAT number, primary address) relevant to your reports.YOURN8NURL/api/v1/get-companies?name=ExampleCorp&response_format=excel to confirm functionality. Receive Company Request (Webhook n8n trigger):
Function: Serves as the public API entry point for the n8n workflow.
Key Configuration: Path is set to /api/v1/get-companies. Response mode is configured to await a specific response node.
Prepare Dynamic Filter (Function n8n node):
Function: Validates the required name query parameter and generates the necessary Odoo filter array, ensuring robust input handling before database interaction.
Key Configuration: Contains JavaScript logic to check for missing 'name' and define the responseformat variable.
Fetch Companies from Odoo (Odoo n8n node):
Function: Communicates with the Odoo API to retrieve records from the res.company resource based on the dynamic filter created by the previous n8n node.
Key Configuration: Operation set to getAll, Resource set to custom (res.company), and filters use an expression linking to the data from the Prepare Dynamic Filter n8n node.
Check If Excel Required (If n8n node):
Function: Manages the flow control, directing the data based on the user's requested output format.
Key Configuration: Checks if {{ $('Prepare Dynamic Filter').item.json.responseformat }} equals 'excel'.
Convert to Excel (Convert to File n8n node):
Function: Converts the incoming JSON data structure into a binary Microsoft Excel (XLSX) file.
Respond with File/Respond with JSON (Respond to Webhook n8n nodes):
Function: Handles sending the final HTTP response. One n8n node handles binary file responses (Excel), and the other handles structured JSON responses.
Automate Jamf Smart Group reporting using this powerful n8n workflow. Automatically fetch membership data, convert it to CSV reports, and share the output directly via a Slack n8n node.

Use this powerful n8n workflow to automatically extract all Jamf policies, convert the structured data to a clean CSV file, and instantly share the audit report via Slack for fast IT compliance checks. Leverage n8n templates for efficient policy management.

Use this core n8n workflow to read a local JSON file and automatically append the extracted data as new rows into a specified Google Sheet. Perfect n8n templates for data integration.

Automate exporting SmartBill PDF invoices to Google Drive using this reusable n8n workflow. Includes folder creation, file fetching via HTTP Request, and robust looping.

Use this powerful n8n workflow to automatically extract keywords, page performance, and daily metrics from Google Search Console and append the data directly into your Google Sheets.


🚀 AI & Automation Expert | n8n Creator | Workflow Specialist | Automation Specialist | V3 Code Studio I build smart automation workflows with n8n to help businesses streamline operations, save time, and increase productivity. Passionate about no-code/low-code automation and AI-driven solutions that make processes efficient, scalable, and growth-oriented.







































