Add new comment

OpenCart orders and options Excel export tool


This script should work in all OpenCart 2.x and OpenCart 3.x because it extracts the data directly from the OpenCart Database and does not rely on any OpenCart directory files. No VQMod, OCMod, theme or permissions required!

The script just dumps readable order data in an Excel file, you may later use Excel functions to auto-format the data according to your needs.

Inside the package

There are two versions of the script within the ZIP package. The first one exports the contents directly to the Excel format and should work in most of the installations if your computer/database/server uses English/Latin character sets.

If the exported XLS appears with strange characters you should use the UTF-8 TXT version of the script. It allows conversion of different database charsets to UTF-8 and then exports it to a semicolon delimited .TXT file that can later be imported into Excel.


1. Edit the script in any text editor. Set the configurations of your database and set an access password. The password will protect the script from outside access and should be different than the DB password.

2. Place the modified script in any accessible (but safe) folder in your server, for example, the OpenCart /admin directory.

3. Access the script by using the following URL. Remember to replace YOURPASSWORD with the password you set in the configuration file.


4. If everything is OK you will be prompted to download the Excel file.

5. Each line of the Excel file represents one order item or item option. You may group options for the same item by using the column product_item.

6. In case of errors, the file will be downloaded in the PHP format. Just edit it to see what's wrong.

7. If the characters are not displaying correctly consider the UTF-8 TXT version of the script. This requires an additional configuration of the source database charset.

Import to Excel - Convert product options to columns

Requirements: Excel 2016 for Windows or previous versions + Microsoft Power Query free addon.

  1. Open the exported file (CSV or XLS).
  2. Select the table columns you want to use. Do not select all the 16000 available spreadsheet columns, just the ones that have data.
  3. In Excel 2016, go to the "Data" menu and then click on "From Table Range". In older Excel versions with Power Query, go to the "Power Query" menu and click on "From Table Range" button.
  4. The query editor will open.
  5. Select the "option_name" column.
  6. Go to "Transform" menu and click on the "Replace Values" button.
  7. Replace "null" by any text, for example "empty".
  8. Keep the "option_name" column selected.
  9. Back in the "Transform" menu, click on the  "Pivot Column" button.
  10. In the dialog box, select "options_value" column to the "Values Column" field and then, inside advanced options, select "Don't aggregate".
  11. Now the table options should appear as columns for each order.
  12. Close the query editor and chose to keep/save the changes. You are back to Excel.

For more information, check this article.

Release notes

Version 5
  • Implemented MySQLi functions for modern PHP 7+ compatibility.


MIT. Do whatever you want with it.

OpenCart 2.x and 3.x
File size
8 KB

Post Categories

The content of this field is kept private and will not be shown publicly.