0

The fields gets exported to XLS, but no labels are generated for every field, but missing field labels. Labels are set for every field in the field option.

Should be:

Field Label 1 | Field Label 2 | etc.
====================================
Data 1        | Data 2        | etc

But now it's just fields with no column labels

====================================
Data 1        | Data 2        | etc

enter image description here

Is it a setting I'm missing out in Views or tpl.php templates needs editing?

1 Answer 1

2

If your spreadsheet is missing the field labels as column headers, chances are the "label" setting is disabled on each field (probably because, you have another display in the view with the labels turned off).

For each field in the Fields section,

  1. Click the field name to open the settings option.
  2. If necessary, be sure to choose For "This views_data_export (override)" from the top of the modal.
  3. Enable the checkbox to Create a label and set the column heading/field label for the spreadsheet.
  4. Click the Apply (this display) button at the bottom of the modal to save the settings for that field.

Views > Configure field Label settings

  1. Save the view, clear your caches, and test the export again.

If the labels are set, the next course of action to check include:

  1. Checking for any template files either in the theme or a custom module that could be overriding the settings.

    • Within the view, you can click the Information link next to Theme at the bottom of the Advanced section (far right of views edit screen). It will list template filenames that could override the view, and render existing templates in bold.
    • Should you find a template outside of the Views Data Export module's folder, you can temporarily remove it and test to see if it resolves the export issue.
  2. Checking to make sure you are running the most up-to-date version of the module.

6
  • You can see in my screenshot every field has a label inside (). Both the Data Export view and the Page view that is set to Display: Table to be displayed on the website and the Data Export view is attached to it to provide the XLS download button/icon. Commented Mar 8, 2018 at 22:57
  • Have you tried disabling the "Better Exposed Filters" option just for the export view's exposed form, using just the "Basic" exposed form setting instead? Also, it may be worth trying to make another basic xls export from scratch to see if you encounter the same issue. If so, there may be a custom tpl.php file taking precedent. Commented Mar 8, 2018 at 23:01
  • I disabled BEF and switched to Basic, no change. The only file I have in my admin theme is views-data-export-xls-header.tpl.php whith content of <?php print $view->display_handler->render_area('header'); ?> Commented Mar 8, 2018 at 23:08
  • I would try temporarily removing the template file to see if it is the culprit. Commented Mar 8, 2018 at 23:15
  • Can you post this as an answer or something, becacuse it was the issue and solved. Commented Mar 8, 2018 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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