VBO Export

Provides bulk export actions for Views Bulk Operations module, enabling users to export selected view rows to CSV, Excel (XLSX), and PDF file formats.

vbo_export
2,781 sites
43
drupal.org

Install

Drupal 11, 10, 9 v4.1.5
composer require 'drupal/vbo_export:^4.1'

Overview

VBO Export is an extension module for Views Bulk Operations (VBO) that adds three powerful export actions to any view with a VBO field. Users can select rows from a view and export them to CSV, Excel (XLSX), or PDF format with a single bulk operation.

The module is designed for sites that need to export data from views - such as content inventories, user lists, order data, or any other structured information displayed in a view. Each export format has its own configurable options, including HTML tag stripping, field selection override, and format-specific settings like CSV separators or PDF page orientation.

Export files are automatically generated and presented to users as downloadable links. Files are stored as temporary files that are automatically cleaned up by Drupal's cron process. For security, when a private file system is configured, export files are stored in the private directory.

Features

  • Export selected view rows to CSV format with configurable separator (semicolon, comma, or pipe)
  • Export selected view rows to Excel XLSX format with professional formatting (bold headers, auto-filter, auto-sized columns, text wrapping)
  • Export selected view rows to PDF format with configurable paper size and orientation
  • Option to strip HTML tags from exported data for clean plain-text output
  • Field override configuration to select specific fields and customize their labels for export
  • Batch processing support for large exports via VBO's batch system
  • Automatic file storage in private directory when available for enhanced security
  • UTF-8 BOM header for CSV files to ensure proper Excel compatibility
  • Theme template for PDF customization
  • Integration with Drupal's temporary file system for automatic cleanup

Use Cases

Content Inventory Export

Create a view listing all content with fields like title, author, created date, status, and content type. Add the VBO field and enable the CSV or Excel export action. Content editors can then select all content (or filter and select specific items) and export a complete content inventory spreadsheet for auditing or reporting purposes.

User List Export for Marketing

Build a view of users with email, name, registration date, and role fields. With VBO Export, administrators can export selected user records to CSV format for import into email marketing platforms or CRM systems, ensuring GDPR compliance by only exporting opted-in users.

Order Data Export for Accounting

For e-commerce sites, create a view of orders with order number, date, customer, total, and status fields. Use the Excel export action to generate professional-looking spreadsheets with formatting that accountants can immediately work with, including auto-filters for easy data analysis.

Generating PDF Reports

Create a view showing event registrations or membership records. Use the PDF export action to generate printable reports with custom formatting via the template. This is useful for generating attendance lists, membership certificates, or official records that need to be printed or emailed as attachments.

Selective Data Migration Preparation

When migrating content between systems, use VBO Export to selectively export specific content items. Configure field override to select only the fields needed for migration and customize labels to match the target system's expected column headers.

Tips

  • Configure the private file system in Drupal for enhanced security - exported files will automatically use private storage when available.
  • Use the 'Strip HTML tags' option when exporting data that will be processed programmatically or imported into other systems.
  • Override field configuration when you need different field selections or labels than what's displayed in the view itself.
  • For very large exports, VBO's batch processing handles the data in chunks to prevent memory issues and timeouts.
  • Customize the PDF template (vbo-export-pdf.html.twig) in your theme to match your organization's branding and formatting requirements.
  • The Excel export automatically includes auto-filter on the header row, making it easy for users to filter and sort data immediately after opening.
  • CSV files include a UTF-8 BOM character, ensuring special characters display correctly when opened in Excel.
  • Temporary export files are automatically cleaned up by Drupal's cron - ensure cron is running regularly to prevent file system bloat.

Technical Details

Hooks 2
hook_help

Implements hook_help to display the README.md content on the module's help page.

hook_theme

Implements hook_theme to define the vbo_export_pdf theme for PDF rendering.

Troubleshooting 7
'PhpSpreadsheet library not installed' error when using Excel export

Install the PhpSpreadsheet library using Composer: composer require phpoffice/phpspreadsheet ^2.2. Then clear caches.

'Dompdf library not installed' error when using PDF export

Install the Dompdf library using Composer: composer require dompdf/dompdf. Supports versions ^1.0, ^2.0, or ^3.0.

Export actions not appearing in VBO field configuration

Ensure the vbo_export module is enabled. Clear all caches. The actions should appear in the 'Selected actions' list when configuring a Views Bulk Operations field.

Exported CSV file shows garbled characters in Excel

The module adds UTF-8 BOM for Excel compatibility. If issues persist, try opening the CSV in Excel using 'Import' rather than 'Open', and explicitly select UTF-8 encoding.

PDF export produces blank pages or missing content

Ensure the vbo-export-pdf.html.twig template is accessible. If using custom templates, verify the template syntax. Complex HTML or CSS may not render correctly in Dompdf.

Large exports timeout or fail

VBO Export uses batch processing for large data sets. Ensure PHP max_execution_time and memory_limit are adequate. Check that VBO is configured to process items in reasonable batch sizes.

Export file download link doesn't work

Check file system permissions on the public or private files directory. Ensure the web server can write to the temporary files location.

Security Notes 5
  • Export files are stored in the private file system when configured, preventing unauthorized direct access to exported data.
  • Files are created as temporary, ensuring automatic cleanup via Drupal's cron process.
  • The 'view' access permission of entities is checked before allowing export - users can only export content they have permission to view.
  • Consider the sensitivity of data being exported - ensure appropriate access controls on views with export functionality.
  • Be cautious with the 'Strip HTML tags' setting disabled, as exported data may contain markup that could be interpreted unexpectedly by consuming applications.