Drupal 7 – Export data using Views data export module with Drush command

Yesterday we talked about exporting data using the Views data export module.
Drupal 7 – Export view data CSV, XML, XLS by Views data export module

The module also provides a Drush command such that you can run the export command in the server which is convenient for backend integration.

The following command is stated in the project page.

  • drush views-data-export [view-name] [display-id] [output-file]

 

You can find the view-name and display-id by mouse over the view display.
drupal7-view-data-export-5
 

But actually the command doesn’t work as expected. For example, the following command will not create the output.csv. Instead, it will print the csv in stdout.

  • drush views-data-export node_export views_data_export_1 output.csv

drupal7-view-data-export-6
 

So if u really want to create the output.csv, you have to feed to stdout to a new file. For example.

  • drush views-data-export node_export views_data_export_1 output > output.csv

 

Done =)

Advertisement

2 thoughts on “Drupal 7 – Export data using Views data export module with Drush command”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.