Articles


How to Export the Drupal Commerce Products inside a drupal site to a xls/csv File.

How to Export the Drupal Commerce Products inside a drupal site to a xls/csv File.



Posted byJibin Jose,1st Feb 2017

For one of our Drupal 7 Commerce site having several products need to export data of those created products. For exporting those products, we first need to create a view containing the products and then export this view via Views data export into CSV/XLS file depends upon the file format we required.

Step 1: Download and Enable the required modules.

For exporting the Commerce product we need to install views_data_export module.

Download and install the Install views_data_export and dependent modules We can download and install directly or even can use the Drush command for downloading and enabling the module. If we need the product image then use the image_url_formatter and views_data_export image_url_formatter. 


Step 2: Create a view with products we need  to export as CSV/XLS

Create a view of products you like to export. The view has to list each product field you like to export, so add each product field. Here are other specifics of the view:

All the fields for the view depend upon the data we required inside the file, the few required fields are size, name product price etc.

Step 3: Configure a new View Display with “Data export”  for export

  • Add a new “Data export” display to your view.
  • Change its “Style” to the desired export type.
  • Configure the options
  • Add a path in the Feed settings such as “pathforxls”.
  • Attach this view to the view containing the products you like to export by
  • updating the “Attach to:” option in feed settings.
  • Ensure “Items to Display” is set to “Display All”


We can also download the file using the Drush command if the view is already there.

drush views-data-export --format= "the required format eg: xls" "View-Name" "View-Display-Name" /pathofthefile.xls --quote-values --st

Categories