Adding extra quotes characters to view exported as CSV

Created on 29 June 2011, over 13 years ago
Updated 8 March 2023, almost 2 years ago

During exporting view to CSV file I found that:
1. if I want to export most of all fields without quotes (using unchecked option in CSV settings), but not all of them
2. and I want to rewrite the output of some fields using quote character (using field option)
3. and the value of those few fields has commas in it (and that's why I need to add extra quotes)
..I can't do it.

Added this code to views_bonus_export.theme.inc file to resolve it:

      // Check if there is value with rewritten output and if it has "" (quotes)
      if (substr($output,0,1) != '"'){
        $vars['themed_rows'][$i][$j] = $wrap . str_replace('"', $replace_value, $output) . $wrap;  
      }else{
        $vars['themed_rows'][$i][$j] = $wrap . $output . $wrap;
      }
✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland lsokolowski

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024