Voting starts in March for the Drupal Association Board election.
This module provides a CSV encoder for Drupal 8 Serialization API. This enables the CSV format to be used for data input and output in various circumstances. For example:
- Drupal 8's REST module can accept or return data in CSV format
- Views can output CSV data via a 'REST Export' view
- Module developers may leverage CSV as a format when using the Serialization API
You must use Composer to manage your Drupal site dependencies. This may require several modifications to your application's root composer.json. You must modify your composer.json in accordance with the linked documentation before following the installation instructions. Please read the documentation if you are not familiar with the specifics of managing a Drupal site with Composer.
- Download the csv_serialization module via Composer:
composer require drupal/csv_serialization. This will only work if your Drupal application meets the requirements listed above.
- Enable modules: rest, csv_serialization
How to create a CSV view
- Create a new view
- Add a "Rest Export" display to the view
- Check ONLY "csv" for Accepted request formats under Format -> Serializer -> Settings
- Set a path for the View display under Path Settings
- Change Format -> Show to "fields"
- Add fields to the view
- Verify that content exists which should be displayed in the view
- Save the view
- Visit the path that you set for the view
- A CSV file should be automatically downloaded when you visit the URL
Notes about the CSV encoder
The CSV format has a number of inherent limitations not present in other formats
(e.g., JSON or XML). Namely, they are:
- A CSV cannot accurately represent the data in an array with a depth greater two. Cell contents must be flattened into a string, which at most represents single-dimensional imploded values.
- Each row in a CSV must share a common set of headers with all other rows.
For these reasons, the CSV format is not well-suited for encoding all data structures--only data with a specific structure. The provided CSV encoder does not support data structures that do not meet these limitations.
- Views Rest Feed permits a "Rest export feed" view display to be attached to another View display as a feed, in the same way that RSS feeds may be attached.
- Maintenance status: Minimally maintained
- Development status: Under active development
- Reported installs: 2,081 sites currently report using this module. View usage statistics.
- Downloads: 18,558
- Last modified: February 4, 2017
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.