Table of Contents
-
Introduction
-
Why Export Dolibarr Sales to Excel?
-
Understanding Dolibarr Sales Modules
-
Overview of Available Export Features
-
Prerequisites and Tools Required
-
Option 1: Manual Export Using Dolibarr’s Built-in Tools
-
Option 2: Automated Export with Scheduled Reports
-
Option 3: Using External Scripts and the REST API
-
Setting Up API Access in Dolibarr
-
Creating a Data Extraction Script (PHP or Python)
-
Formatting the Output into Excel (XLSX/CSV)
-
Automating Script Execution with Cron Jobs
-
Filtering Sales by Date, Status, or Product
-
Mapping Custom Fields and Extra Columns
-
Securing Access to Exported Files
-
Sending the Export by Email or Cloud Sync
-
Using Modules from Dolistore for Excel Exports
-
Best Practices for Handling Large Datasets
-
Troubleshooting Common Issues
-
Conclusion and Optimization Tips
1. Introduction
Exporting sales data is a common need for business owners, accountants, and sales managers using Dolibarr ERP. Whether for reporting, analysis, or importing into external BI tools, automating this export process saves time and ensures consistency. This article offers an in-depth look at the options available to export sales data from Dolibarr to Excel, including full automation.
2. Why Export Dolibarr Sales to Excel?
-
Create customized financial reports
-
Share sales data with stakeholders
-
Perform detailed analysis using Excel’s tools
-
Feed external dashboards or accounting systems
3. Understanding Dolibarr Sales Modules
Dolibarr stores sales-related data in modules such as:
-
Proposals
-
Orders
-
Invoices
-
Payments
Each module supports standard fields (amount, date, client) and custom fields (extra fields defined by users).
4. Overview of Available Export Features
Dolibarr supports export to CSV via:
-
Lists view (with selected filters)
-
Export tab in each module
-
Third-party tools using the REST API
5. Prerequisites and Tools Required
-
Dolibarr version 10.0 or higher
-
Admin access to the Dolibarr instance
-
Optional: API access enabled
-
Excel, Google Sheets, or LibreOffice
-
Cron tool or task scheduler (for automation)
6. Option 1: Manual Export Using Dolibarr’s Built-in Tools
Steps:
-
Navigate to Invoices > List
-
Apply desired filters (date range, status, client)
-
Click the Export button
-
Select fields to include
-
Choose CSV or Excel-compatible format
This works well for one-off reports.
7. Option 2: Automated Export with Scheduled Reports
Some modules or custom scripts support scheduled exports:
-
Use the Reports module (with external patch)
-
Create a predefined export template
-
Schedule a task to run and save the file automatically to a folder or send by email
8. Option 3: Using External Scripts and the REST API
For full automation:
-
Create a script (Python, PHP, Node.js)
-
Use Dolibarr’s REST API to extract data from
/invoices
,/orders
, etc. -
Convert JSON to structured Excel file using libraries like:
-
Python: pandas, openpyxl
-
PHP: PhpSpreadsheet
-
Node.js: exceljs
-
9. Setting Up API Access in Dolibarr
-
Go to Setup > Modules > API
-
Enable REST API module
-
Create API key for a user
-
Test access to endpoints using Postman or Curl
10. Creating a Data Extraction Script (PHP or Python)
Basic Python Example:
import requests, json
import pandas as pd
headers = {'DOLAPIKEY': 'your_api_key'}
url = 'https://yourdomain.com/api/index.php/invoices'
response = requests.get(url, headers=headers)
data = response.json()
df = pd.json_normalize(data)
df.to_excel('dolibarr_sales.xlsx', index=False)
11. Formatting the Output into Excel (XLSX/CSV)
Ensure the data includes:
-
Invoice number
-
Client name
-
Total (HT and TTC)
-
Status
-
Payment date
Sort and format columns for readability.
12. Automating Script Execution with Cron Jobs
Example Cron entry:
0 7 * * * /usr/bin/python3 /home/user/export_dolibarr_sales.py
This runs the script daily at 7:00 AM.
13. Filtering Sales by Date, Status, or Product
Use URL parameters in API call:
/api/index.php/invoices?limit=100&sortfield=date&sortorder=desc&sqlfilters=(date>=2024-01-01)
Filter results before exporting.
14. Mapping Custom Fields and Extra Columns
Use /invoices/{id}
to access full object Extract extra fields from array_options
section Append them as columns in Excel output
15. Securing Access to Exported Files
-
Store files in restricted folders
-
Encrypt files before sending by email
-
Use SFTP for server-to-server transfers
16. Sending the Export by Email or Cloud Sync
-
Use
smtplib
(Python) orPHPMailer
to email exports -
Sync with Google Drive or Dropbox via API
17. Using Modules from Dolistore for Excel Exports
Modules such as:
-
ExcelExport Pro
-
Custom Exporter Provide GUI tools to schedule and customize export jobs.
18. Best Practices for Handling Large Datasets
-
Use pagination in API calls
-
Avoid exporting unnecessary fields
-
Compress files before transferring
-
Schedule exports during off-peak hours
19. Troubleshooting Common Issues
-
Missing fields: Check user permissions
-
Empty files: API rate limit or filter mismatch
-
Excel format errors: Use correct encoding (UTF-8) and column mapping
20. Conclusion and Optimization Tips
Exporting Dolibarr sales data to Excel can be as simple or advanced as your needs require. Start with manual exports, then move to automated scripts or use marketplace modules for more flexibility. With the right setup, you'll gain actionable insight from your sales data without wasting hours on repetitive tasks.
For long-term scalability:
-
Implement version control for your scripts
-
Automate alerts on export success/failure
-
Archive historical files with naming conventions
This integration transforms Dolibarr into a reporting powerhouse, unlocking better data visibility and decision-making power.