1

I'm working on a drupal 7 site and my client would like to have a certain view export as a CSV once a day into a folder. My initial thought was to tie this functionality to our cron schedule, but I'm running into a wall. How can I add functionality to cron? And more specifically, how could I get a specific view to export as a CSV during cron?

Thanks!

2

You might want to look at the Views Data Export contrib module: https://www.drupal.org/project/views_data_export

This module exposes a drush command that can execute the view and save its results to a file.

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

Since you can call this command via drush from the shell, you should also be able to add the drush command to the operating system crontab (not Drupal cron) so that it executes on a schedule:

https://www.ostechnix.com/a-beginners-guide-to-cron-jobs/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.