Skip to content
GravityKit
Buy
Sign in
0 items
  • Plugins

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, PDF, or Google Sheets, then share them with secure links or deliver them to cloud storage on a schedule.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data, including forms, entries, Views, feeds, uploads, and more.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    • GravitySearch

      GravitySearch

      Search Gravity Forms entries across every form from one screen.

  • Ideal For

    • Nonprofits
    • Web Agencies
    • Education
    • Developers
    • Small Businesses
    • Startups
    Explore All Use Cases

    Case studies

    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    View All Case Studies
  • Resources

    • Blog
    • Case studies
    • Newsletter
    • GravityKit vs competitors
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy

    Ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Plugins

    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, PDF, or Google Sheets, then share them with secure links or deliver them to cloud storage on a schedule.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data, including forms, entries, Views, feeds, uploads, and more.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    • GravitySearch

      GravitySearch

      Search Gravity Forms entries across every form from one screen.

    View All Products

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
  • Ideal For

    • Nonprofits
    • Web Agencies
    • Education
    • Developers
    • Small Businesses
    • Startups
    Explore All Use Cases

    Case studies

    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    View All Case Studies

    How to build...

    • Property Management
    • Product Catalog
    • Fundraising Dashboard
    • Real Estate Directory
    • Document Library
    • Academic Journal
    • Volunteer Management
    • Meal Tracker
    View All Guides
  • Resources

    • Blog
    • Case studies
    • Newsletter
    • GravityKit vs competitors
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy

    ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Support
  • Pricing
0 items

Search

Results appear automatically as you type.
Loading results…

results found matching

    Sign in
    Buy

    Docs

    • Docs Home

    Gravity Forms Add-Ons

    • GravityView
    • GravityActions
    • GravityBoard
    • GravityCalendar
    • GravityCharts
    • GravityEdit
    • GravityExport
    • GravityImport
    • GravityMath
    • GravityMigrate
    • GravityRevisions
    • GravitySearch
    • GF Widget for Elementor
    • GF Dynamic Lookup
    • GF Entry Tags
    • GF Event Field
    • GravityExport Lite
    • GF Zero Spam

    GravityView

    • Getting Started
    • View Setup
    • FAQ
    • Pre-Sale
    • Advanced
    • Common Problems
    • Customizing Your Views
    • Edit Entry
    • Entry Approval
    • Filter and Sort Results
    • Gravity Forms
    • Merge Tags
    • Roles and Capabilities
    • Search
    • Shortcodes
    • View Settings
    • WordPress Posts

    General Help

    • Account, Invoices, and Billing
    • License Related
    • Plugins and Settings
    • Contact
    • Docs Home
    • Gravity Forms Add-Ons

      • GravityView
      • GravityActions
      • GravityBoard
      • GravityCalendar
      • GravityCharts
      • GravityEdit
      • GravityExport
      • GravityImport
      • GravityMath
      • GravityMigrate
      • GravityRevisions
      • GravitySearch
      • GF Widget for Elementor
      • GF Dynamic Lookup
      • GF Entry Tags
      • GF Event Field
      • GravityExport Lite
      • GF Zero Spam
    • GravityView

      • Getting Started
      • View Setup
      • FAQ
      • Pre-Sale
      • Advanced
      • Common Problems
      • Customizing Your Views
      • Edit Entry
      • Entry Approval
      • Filter and Sort Results
      • Gravity Forms
      • Merge Tags
      • Roles and Capabilities
      • Search
      • Shortcodes
      • View Settings
      • WordPress Posts
    • General Help

      • Account, Invoices, and Billing
      • License Related
      • Plugins and Settings
    • Contact

    GravityExport

    • Checkbox values for removed choices are missing from exports
    • Export Gravity Forms entries to Google Sheets
    • Adding a download button for entries in GravityView using GravityExport
    • Attaching all entries to an e-mail in GravityExport
    • Attaching an entry export to a notification using GravityExport Lite
    • Changing labels in GravityExport
    • Changing the File Format of a Report by Adding the File Extension to the URL
    • Changing values in GravityExport
    • Connecting Dropbox to GravityExport
    • Connecting FTP to GravityExport
    • Customize Download URLs in GravityExport
    • Filtering entries included in a GravityExport download
    • Filtering GravityExport with conditional logic and relative dates
    • Formatting an address in GravityExport
    • Getting started with GravityExport
    • GravityExport and caching plugins
    • GravityExport Developer Hooks
    • GravityExport FAQ
    • GravityExport field: BaseField
    • GravityExport field: DateField
    • GravityExport field: FileUploadField
    • GravityExport field: ListField
    • GravityExport field: MetaField
    • GravityExport field: NotesField
    • GravityExport field: NumberField
    • GravityExport field: ProductField
    • GravityExport field: RepeaterField
    • GravityExport field: SectionField
    • GravityExport field: SeparableField
    • GravityExport Filters
    • GravityExport: Exporting only one entry
    • GravityExport: How to output dropdown field labels Instead of values
    • GravityExport: Splitting complex fields in Multiple Columns
    • GravityExport: The “Enable multi-row splitting” setting
    • How Is GravityExport Lite Different From GravityExport?
    • How to configure GravityExport to save File Upload fields
    • How to export all forms in bulk to an Excel spreadsheet
    • How to Export Checkbox Fields as Separate Columns in GravityExport
    • How to re-run a GravityExport Save feed
    • How to schedule automated exports
    • How to trigger a GravityExport Save Feed
    • How to use FastCron to trigger exports on a custom schedule
    • PDF export settings and style controls
    • Restricting file access in GravityExport & GravityExport Lite
    • Styling PDF file exports using CSS
    • Home
    • Docs
    • GravityExport
    • GravityExport Developer Hooks

    GravityExport Developer Hooks

    Estimated reading: 28 minutes

    Updated on August 18, 2026

    These are the developer hooks available in GravityExport Lite and GravityExport. All code is provided as examples and should be tested before being used. See how to add custom PHP to your site. For the complete reference of every action and filter, see the GravityExport section of the GravityKit developer documentation.

    Most hooks use gf_apply_filters() , so they are also available with _{form_id}  added to the filter name (example: gfexcel_renderer_matrix_{form_id}). Using the form filters will only modify values associated with that specific form.


    gfexcel_renderer_matrix #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Modify the export matrix before it’s rendered. The matrix is a two-dimensional array containing header row and all entry data rows.

    PropertyTypeDefaultDescription
    $matrix array N/ATwo-dimensional array with row 0 as header, rows 1+ as data
    $form array N/AGravity Forms form object

    Matrix Structure

    The matrix is a two-dimensional array where:

    • Row 0 (Header): Contains column header objects (GFExcelValuesStringValue  )
    • Row 1+ (Data): Contains entry data as value objects

    Each cell in the matrix is an implementation of the GFExcelValuesBaseValue  object, for example:

    • GFExcelValuesStringValue   – Text values
    • GFExcelValuesNumericValue   – Numeric values (Entry ID, User ID, etc.)

    Value Object Properties

    All value objects extend from a base class and include:

    PropertyTypeAccessDescription
    value  mixed  protected  The actual cell value
    gf_field  GF_Field  protected  Associated Gravity Forms field object
    is_numeric  bool  protected  Whether value should be formatted as number
    color  string  protected  Text color
    background_color  string  protected  Cell background color
    is_bold  bool  protected  Bold formatting
    is_italic  bool  protected  Italic formatting
    url  string  protected  Hyperlink URL

    Removing columns with only empty values

    This code filters out columns from being included in the export where all the values in the column are empty.

    /**
     * Remove empty columns from the matrix.
     *
     * Filters out columns where all values (excluding the header) are empty.
     *
     * @since 1.0.0
     *
     * @param array $matrix The matrix containing all rows and columns. First row is the header.
     * @param array $form   The form object (unused; required by filter signature).
     *
     * @return array The matrix with empty columns removed.
     */
    function gfexcel_remove_empty_columns( $matrix, $form ) {
    	if ( empty( $matrix ) || count( $matrix ) < 2 ) {
    		return $matrix; // Need header + at least one data row.
    	}
    
    	/**
    	 * Determine whether a cell value should be considered empty.
    	 *
    	 * Preserves 0, '0', 0.0, and false as non-empty.
    	 *
    	 * @param mixed $value The value to check.
    	 * @return bool
    	 */
    	$is_empty = static function( $value ): bool {
    		// Unwrap GFExcel value objects.
    		if ( is_object( $value ) && method_exists( $value, 'getValue' ) ) {
    			$value = $value->getValue();
    		}
    
    		// Empty arrays are empty; non-empty arrays are not.
    		if ( is_array( $value ) ) {
    			return count( $value ) === 0;
    		}
    
    		if ( is_string( $value ) ) {
    			return '' === trim( $value );
    		}
    
    		return $value === null || $value === '';
    	};
    
    	$data_rows       = array_slice( $matrix, 1 );
    	$column_count    = count( $matrix[0] );
    	$columns_to_keep = [];
    
    	// Find columns with at least one non-empty value.
    	for ( $col_index = 0; $col_index < $column_count; $col_index++ ) {
    		foreach ( $data_rows as $row ) {
    			$val = $row[ $col_index ] ?? null;
    
    			if ( ! $is_empty( $val ) ) {
    				$columns_to_keep[] = $col_index;
    				continue 2; // Skip to next column.
    			}
    		}
    	}
    
    	// Rebuild matrix keeping only non-empty columns.
    	if ( empty( $columns_to_keep ) ) {
    		// All columns empty: return empty rows with no columns.
    		return array_fill( 0, count( $matrix ), [] );
    	}
    
    	$keep_flip = array_flip( $columns_to_keep );
    
    	return array_map(
    		static function( $row ) use ( $keep_flip ) {
    			return array_values( array_intersect_key( $row, $keep_flip ) );
    		},
    		$matrix
    	);
    }
    
    add_filter( 'gfexcel_renderer_matrix', 'gfexcel_remove_empty_columns', 10, 2 );

    Removing the header row

    If you want to remove the header row from GravityKit export, add this code to your site. This will remove the first row.

    /**
     * Remove the values from the first row of the matrix. The columns still exist, but the values are empty. This removes the first (header) row.
     * @param mixed[] $matrix The matrix containing all rows and columns.
     * @return mixed[] The matrix containing all rows and columns.
     */
    add_filter( 'gfexcel_renderer_matrix', function( $matrix ) {
      unset( $matrix[0] ); // Unset the first row. Doesn't remove the row, only the values.
      return array_values( $matrix ); // Re-indexes the array to start at 0, removing the first row.
    }, 10, 1 );

    gfexcel_renderer_hide_row #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Hide specific rows from the export based on custom logic.

    PropertyTypeDefaultDescription
    $hide bool false Whether to hide the row
    $row array N/AArray of cell values for the current row
    $form_id int N/AThe form ID

    Sample code

    /**
     * Hide rows where field 1 is empty.
     *
     * @param bool  $hide    Whether to hide the row.
     * @param array $row     The row data.
     * @param int   $form_id The form ID.
     * @return bool True to hide the row.
     */
    function gravityexport_hide_empty_field_rows( $hide, $row, $form_id ) {
        foreach ( $row as $column ) {
            if ( 1 === $column->getFieldId() && empty( $column->getValue() ) ) {
                return true;
            }
        }
    
        return $hide;
    }
    add_filter( 'gfexcel_renderer_hide_row', 'gravityexport_hide_empty_field_rows', 10, 3 );

    gfexcel_renderer_columns_max_width #

    Applies to: Excel (.xlsx), PDF (.pdf)

    Set the maximum width for auto-sized columns in the export.

    PropertyTypeDefaultDescription
    $max_width int|null null Maximum column width in Excel units (null = no limit)

    Sample code

    /**
     * Limit column width to 50 units.
     *
     * @param int|null $max_width The maximum column width.
     * @return int The new maximum width.
     */
    function gravityexport_set_max_column_width( $max_width ) {
        return 50;
    }
    add_filter( 'gfexcel_renderer_columns_max_width', 'gravityexport_set_max_column_width' );

    gfexcel_renderer_wrap_text #

    Applies to: Excel (.xlsx), PDF (.pdf)

    Control whether cell text should wrap.

    PropertyTypeDefaultDescription
    $wrap_text bool true Whether to wrap text in cells
    $cell Cell N/APhpSpreadsheet Cell object
    $value BaseValue|mixed N/AThe cell value object or raw value
    $form_id int N/AThe form ID

    Sample code

    /**
     * Disable text wrapping for all cells.
     *
     * @param bool  $wrap_text Whether to wrap text.
     * @param Cell  $cell      The cell object.
     * @param mixed $value     The cell value.
     * @param int   $form_id   The form ID.
     * @return bool False to disable text wrapping.
     */
    function gravityexport_disable_text_wrap( $wrap_text, $cell, $value, $form_id ) {
        return false;
    }
    add_filter( 'gfexcel_renderer_wrap_text', 'gravityexport_disable_text_wrap', 10, 4 );

    gfexcel_renderer_worksheet_title #

    Applies to: Excel (.xlsx), PDF (.pdf)

    Customize the worksheet/tab name in the Excel file, or the document title in PDF exports.

    PropertyTypeDefaultDescription
    $title string Form titleWorksheet title (max 30 characters)
    $form array N/AThe form object
    $form_id int N/AThe form ID

    Sample code

    /**
     * Add form ID to worksheet title.
     *
     * @param string $title   The worksheet title.
     * @param array  $form    The form object.
     * @param int    $form_id The form ID.
     * @return string Modified worksheet title.
     */
    function gravityexport_custom_worksheet_title( $title, $form, $form_id ) {
        return sprintf( 'Form %d - %s', $form_id, $title );
    }
    add_filter( 'gfexcel_renderer_worksheet_title', 'gravityexport_custom_worksheet_title', 10, 3 );

    gfexcel_renderer_disable_hyperlinks #

    Applies to: Excel (.xlsx), PDF (.pdf)

    Disable hyperlinks in the export globally.

    PropertyTypeDefaultDescription
    $disable bool false Whether to disable all hyperlinks

    Sample code

    /**
     * Disable all hyperlinks in export.
     *
     * @return bool True to disable hyperlinks.
     */
    add_filter( 'gfexcel_renderer_disable_hyperlinks', '__return_true' );

    gfexcel_output_rows #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Modify the rows before they’re processed into the matrix.

    PropertyTypeDefaultDescription
    $rows array N/AArray of entry rows
    $form array N/AThe form object
    $form_id int N/AThe form ID

    Sample code

    /**
     * Filter out test entries from export.
     *
     * @param array $rows    The entry rows.
     * @param array $form    The form object.
     * @param int   $form_id The form ID.
     * @return array Filtered rows.
     */
    function gravityexport_remove_test_entries( $rows, $form, $form_id ) {
        return array_filter( $rows, function( $row ) {
            // Remove entries with "test" in field 1
            return false === stripos( $row[1], 'test' );
        } );
    }
    add_filter( 'gfexcel_output_rows', 'gravityexport_remove_test_entries', 10, 3 );

    gfexcel_output_columns #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Modify which columns are included in the export.

    PropertyTypeDefaultDescription
    $columns array N/AArray of column field objects
    $form array N/AThe form object
    $form_id int N/AThe form ID

    Sample code

    /**
     * Remove specific columns from export.
     *
     * @param array $columns The column fields.
     * @param array $form    The form object.
     * @param int   $form_id The form ID.
     * @return array Modified columns.
     */
    function gravityexport_remove_admin_columns( $columns, $form, $form_id ) {
        return array_filter( $columns, function( $column ) {
            // Remove admin-only fields
            return ! in_array( $column->id, [ 'ip', 'user_agent' ], true );
        } );
    }
    add_filter( 'gfexcel_output_columns', 'gravityexport_remove_admin_columns', 10, 3 );

    gfexcel_output_search_criteria #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Modify the search criteria used to fetch entries for export.

    PropertyTypeDefaultDescription
    $search_criteria array ['status' => 'active'] GFAPI search criteria array
    $form_id int N/AThe form ID
    $feed_id int N/AThe feed ID (if applicable)

    Sample code

    /**
     * Only export entries from last 30 days.
     *
     * @param array $search_criteria The search criteria.
     * @param int   $form_id         The form ID.
     * @param int   $feed_id         The feed ID.
     * @return array Modified search criteria.
     */
    function gravityexport_last_30_days( $search_criteria, $form_id, $feed_id ) {
        $search_criteria['start_date'] = date( 'Y-m-d', strtotime( '-30 days' ) );
        $search_criteria['end_date']   = date( 'Y-m-d' );
    
        return $search_criteria;
    }
    add_filter( 'gfexcel_output_search_criteria', 'gravityexport_last_30_days', 10, 3 );

    gfexcel_output_sorting_options #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Customize how entries are sorted in the export.

    PropertyTypeDefaultDescription
    $sorting array ['key' => 'date_created', 'direction' => 'ASC'] Sorting configuration
    $form_id int N/AThe form ID
    $feed_id int N/AThe feed ID (if applicable)

    Sample code

    /**
     * Sort by entry ID descending.
     *
     * @param array $sorting The sorting options.
     * @param int   $form_id The form ID.
     * @param int   $feed_id The feed ID.
     * @return array Modified sorting options.
     */
    function gravityexport_sort_by_id_desc( $sorting, $form_id, $feed_id ) {
        return [
            'key'       => 'id',
            'direction' => 'DESC',
        ];
    }
    add_filter( 'gfexcel_output_sorting_options', 'gravityexport_sort_by_id_desc', 10, 3 );

    gfexcel_field_checkbox_empty #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Define the value to use for empty checkbox fields.

    PropertyTypeDefaultDescription
    $empty_value string '' Value to use for unchecked checkboxes
    $field GF_Field N/AThe checkbox field object
    $form_id int N/AThe form ID

    Sample code

    /**
     * Use "No" for empty checkboxes.
     *
     * @param string   $empty_value The empty value.
     * @param GF_Field $field       The field object.
     * @param int      $form_id     The form ID.
     * @return string The new empty value.
     */
    function gravityexport_checkbox_empty_no( $empty_value, $field, $form_id ) {
        return 'No';
    }
    add_filter( 'gfexcel_field_checkbox_empty', 'gravityexport_checkbox_empty_no', 10, 3 );

    gfexcel_field_date_format #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Customize the date format for date fields in the export.

    PropertyTypeDefaultDescription
    $format string Field formatPHP date format string
    $field GF_Field N/AThe date field object
    $form_id int N/AThe form ID
    $input_id string N/AThe input ID (for multi-input fields)

    Sample code

    /**
     * Use ISO 8601 date format.
     *
     * @param string   $format   The date format.
     * @param GF_Field $field    The field object.
     * @param int      $form_id  The form ID.
     * @param string   $input_id The input ID.
     * @return string The new date format.
     */
    function gravityexport_iso_date_format( $format, $field, $form_id, $input_id ) {
        return 'Y-m-d';
    }
    add_filter( 'gfexcel_field_date_format', 'gravityexport_iso_date_format', 10, 4 );

    gfexcel_combiner_glue #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Customize the separator used when combining multi-value fields.

    PropertyTypeDefaultDescription
    $glue string ', ' String used to join multiple values
    $field_type string N/AThe field type (e.g., ‘checkbox’, ‘multiselect’)
    $field_id int N/AThe field ID
    $form_id int N/AThe form ID

    Sample code

    /**
     * Use semicolon separator for checkbox fields.
     *
     * @param string $glue       The separator string.
     * @param string $field_type The field type.
     * @param int    $field_id   The field ID.
     * @param int    $form_id    The form ID.
     * @return string The new separator.
     */
    function gravityexport_semicolon_separator( $glue, $field_type, $field_id, $form_id ) {
        if ( 'checkbox' === $field_type ) {
            return '; ';
        }
    
        return $glue;
    }
    add_filter( 'gfexcel_combiner_glue', 'gravityexport_semicolon_separator', 10, 4 );

    gfexcel_file_extension #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Set the file extension/format for a specific form’s exports.

    PropertyTypeDefaultDescription
    $extension string 'xlsx' File extension (‘xlsx’, ‘csv’, or ‘pdf’)
    $form array N/AThe form object

    Sample code

    /**
     * Use CSV format for form ID 5.
     *
     * @param string $extension The file extension.
     * @param array  $form      The form object.
     * @return string The file extension.
     */
    function gravityexport_csv_for_form_5( $extension, $form ) {
        if ( 5 === (int) rgar( $form, 'id' ) ) {
            return 'csv';
        }
    
        return $extension;
    }
    add_filter( 'gfexcel_file_extension', 'gravityexport_csv_for_form_5', 10, 2 );

    gfexcel_file_extensions #

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Register available file format extensions that the plugin recognizes.

    PropertyTypeDefaultDescription
    $extensions array ['xlsx', 'csv'] Array of supported extensions

    Sample code

    /**
     * Add custom export format.
     *
     * @param array $extensions Supported extensions.
     * @return array Modified extensions array.
     */
    function gravityexport_add_custom_format( $extensions ) {
        $extensions[] = 'ods'; // OpenDocument Spreadsheet
    
        return $extensions;
    }
    add_filter( 'gfexcel_file_extensions', 'gravityexport_add_custom_format' );

    CSV-Specific Filters #

    The following filters only apply to CSV (.csv) exports.

    gfexcel_renderer_csv_delimiter

    Applies to: CSV (.csv) only

    Set the CSV delimiter character.

    PropertyTypeDefaultDescription
    $delimiter string ',' CSV delimiter character
    $form_id int N/AThe form ID

    Sample code

    /**
     * Use semicolon delimiter for CSV.
     *
     * @param string $delimiter The delimiter.
     * @param int    $form_id   The form ID.
     * @return string The new delimiter.
     */
    function gravityexport_semicolon_delimiter( $delimiter, $form_id ) {
        return ';';
    }
    add_filter( 'gfexcel_renderer_csv_delimiter', 'gravityexport_semicolon_delimiter', 10, 2 );

    gfexcel_renderer_csv_enclosure

    Applies to: CSV (.csv) only

    Set the CSV enclosure character.

    PropertyTypeDefaultDescription
    $enclosure string '"' CSV enclosure character
    $form_id int N/AThe form ID

    gfexcel_renderer_csv_line_ending

    Applies to: CSV (.csv) only

    Set the CSV line ending character(s).

    PropertyTypeDefaultDescription
    $line_ending string "rn" CSV line ending
    $form_id int N/AThe form ID

    gfexcel_renderer_csv_use_bom

    Applies to: CSV (.csv) only

    Control whether to include BOM (Byte Order Mark) in CSV.

    PropertyTypeDefaultDescription
    $use_bom bool false Whether to include UTF-8 BOM
    $form_id int N/AThe form ID

    Sample code

    /**
     * Add UTF-8 BOM for Excel compatibility.
     *
     * @param bool $use_bom Whether to use BOM.
     * @param int  $form_id The form ID.
     * @return bool True to include BOM.
     */
    function gravityexport_enable_bom( $use_bom, $form_id ) {
        return true;
    }
    add_filter( 'gfexcel_renderer_csv_use_bom', 'gravityexport_enable_bom', 10, 2 );

    gfexcel_renderer_csv_include_separator_line

    Applies to: CSV (.csv) only

    Include a separator line at the top of CSV files.

    PropertyTypeDefaultDescription
    $include bool false Whether to include separator line
    $form_id int N/AThe form ID

    gfexcel_renderer_csv_output_encoding

    Applies to: CSV (.csv) only

    Set the CSV output encoding.

    PropertyTypeDefaultDescription
    $encoding string 'UTF-8' Output encoding
    $form_id int N/AThe form ID

    Advanced Filters #

    gfexcel_value_type

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Change the value object class used to render a specific field’s data.

    PropertyTypeDefaultDescription
    $type string Field-dependentValue class name (e.g., ‘StringValue’, ‘NumericValue’)
    $field_type string N/AThe field input type
    $form_id int N/AThe form ID
    $field_id int N/AThe field ID
    $gf_field GF_Field N/AThe field object
    $is_label bool false Whether this value object is for a label

    gfexcel_field_separated

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Control whether a field should be split into separate columns (applies to Name, Address, and similar multi-part fields).

    PropertyTypeDefaultDescription
    $separated bool Settings-dependentWhether to separate into multiple columns
    $field_type string N/AThe field input type (e.g., ‘name’, ‘address’)
    $form_id int N/AThe form ID
    $field_id int N/AThe field ID
    $field GF_Field N/AThe field object

    Sample code

    /**
     * Keep name field as single column.
     *
     * @param bool     $separated  Whether to separate.
     * @param string   $field_type The field input type.
     * @param int      $form_id    The form ID.
     * @param int      $field_id   The field ID.
     * @param GF_Field $field      The field object.
     * @return bool False to keep as single column.
     */
    function gravityexport_single_name_column( $separated, $field_type, $form_id, $field_id, $field ) {
        if ( 'name' === $field_type ) {
            return false;
        }
    
        return $separated;
    }
    add_filter( 'gfexcel_field_separated', 'gravityexport_single_name_column', 10, 5 );

    gfexcel_field_label

    Applies to: Excel (.xlsx), CSV (.csv), PDF (.pdf)

    Customize field labels (column headers) in the export.

    PropertyTypeDefaultDescription
    $label string Field labelThe column header label
    $field_type string N/AThe field input type
    $form_id int N/AThe form ID
    $field_id int N/AThe field ID
    $field GF_Field N/AThe field object

    Sample code

    /**
     * Add field ID to column headers.
     *
     * @param string   $label      The field label.
     * @param string   $field_type The field input type.
     * @param int      $form_id    The form ID.
     * @param int      $field_id   The field ID.
     * @param GF_Field $field      The field object.
     * @return string Modified label.
     */
    function gravityexport_add_id_to_label( $label, $field_type, $form_id, $field_id, $field ) {
        return sprintf( '%s (ID: %d)', $label, $field_id );
    }
    add_filter( 'gfexcel_field_label', 'gravityexport_add_id_to_label', 10, 5 );

    Actions #

    gfexcel_renderer_cell_properties

    Applies to: Excel (.xlsx), PDF (.pdf)

    Modify cell properties directly using PhpSpreadsheet API.

    PropertyTypeDescription
    $cell Cell PhpSpreadsheet Cell object
    $value BaseValue|mixed The cell value object or raw value
    $form_id int The form ID

    Sample code

    /**
     * Make header row bold with background color.
     *
     * @param Cell  $cell    The cell object.
     * @param mixed $value   The cell value.
     * @param int   $form_id The form ID.
     */
    function gravityexport_style_header_row( $cell, $value, $form_id ) {
        if ( 1 !== $cell->getRow() ) {
            return;
        }
    
        $cell->getStyle()->getFont()->setBold( true );
        $cell->getStyle()->getFill()
            ->setFillType( PhpOfficePhpSpreadsheetStyleFill::FILL_SOLID )
            ->getStartColor()->setRGB( 'CCCCCC' );
    }
    add_action( 'gfexcel_renderer_cell_properties', 'gravityexport_style_header_row', 10, 3 );

    GravityExport Save hooks #

    The hooks below apply to Save feeds rather than to the file renderers above. The first three were added in GravityExport 1.15.0 (Google Sheets export, connection monitoring, and copying feeds to other forms). The four that follow cover scheduled and manual export runs; each entry notes the version it was added in.

    gk/gravityexport/sheets/rows-page

    Applies to: Google Sheets export (filter)

    Modify each page of rows before it is written to Google Sheets. The filter fires once per page, so a listener sees part of the export at a time and should not assume it is looking at the whole sheet or at the header row.

    PropertyTypeDescription
    $rowsarray[]The page’s rows of scalar values
    $form_idintThe form being exported
    $offsetintNumber of entries skipped before this page

    Sample code

    /**
     * Write "N/A" instead of an empty cell for form 12.
     *
     * @param array[] $rows    The page's rows.
     * @param int     $form_id The form ID.
     * @param int     $offset  Entries skipped before this page.
     * @return array[] Modified rows.
     */
    function gravityexport_sheets_fill_blanks( $rows, $form_id, $offset ) {
        if ( 12 !== (int) $form_id ) {
            return $rows;
        }
    
        foreach ( $rows as &$row ) {
            foreach ( $row as &$cell ) {
                if ( '' === $cell ) {
                    $cell = 'N/A';
                }
            }
        }
    
        return $rows;
    }
    add_filter( 'gk/gravityexport/sheets/rows-page', 'gravityexport_sheets_fill_blanks', 10, 3 );

    gk/gravityexport/save/monitored-connection/failed

    Applies to: Cloud storage connections with Monitor connections enabled (action)

    Fires when a monitored cloud storage connection (Google Sheets, Dropbox, or Box) is found to be offline. Use it to notify someone or log the outage. It fires once when the connection changes state, not on every check.

    PropertyTypeDescription
    $providerMonitorableConnectionThe offline connection. getId() returns its slug and getTitle() its display name

    Sample code

    /**
     * Email the site admin when a cloud connection goes offline.
     *
     * @param MonitorableConnection $provider The offline connection.
     */
    function gravityexport_notify_connection_offline( $provider ) {
        wp_mail(
            get_option( 'admin_email' ),
            sprintf( 'GravityExport: %s connection is offline', $provider->getTitle() ),
            'Reconnect it under GravityKit > Settings > GravityExport before scheduled exports fail.'
        );
    }
    add_action( 'gk/gravityexport/save/monitored-connection/failed', 'gravityexport_notify_connection_offline' );

    gk/gravityexport/save/feed-copy/unknown-key

    Applies to: The Copy to Other Forms bulk action on Save feeds (filter)

    Decide whether a feed meta key the copier does not recognize (for example, one added by your own code) is copied to the target form or dropped. Return 'copy' or 'drop'. The default is 'copy'.

    PropertyTypeDescription
    $actionstringThe action to take. Default 'copy'; accepts 'copy' or 'drop'
    $keystringThe unrecognized meta key
    $valuemixedThe value stored under the key
    $source_metaarrayThe full source feed meta
    $target_form_idintThe form the feed is being copied to

    Sample code

    /**
     * Don't carry a per-form note over when a feed is copied.
     *
     * @param string $action         'copy' or 'drop'.
     * @param string $key            The unrecognized meta key.
     * @param mixed  $value          Its value.
     * @param array  $source_meta    The source feed meta.
     * @param int    $target_form_id The target form ID.
     * @return string 'copy' or 'drop'.
     */
    function gravityexport_drop_note_on_copy( $action, $key, $value, $source_meta, $target_form_id ) {
        if ( 'my_plugin_form_note' === $key ) {
            return 'drop';
        }
    
        return $action;
    }
    add_filter( 'gk/gravityexport/save/feed-copy/unknown-key', 'gravityexport_drop_note_on_copy', 10, 5 );

    gk/gravityexport/save/cron/completed

    Applies to: Scheduled export runs (action, since 1.7.0)

    Fires after a scheduled export finishes successfully, whether it ran in one pass or in chunks. Only scheduled runs fire it. Exports triggered by a new entry, a webhook, or Export Now do not.

    PropertyTypeDescription
    $feedarrayThe Gravity Forms feed array
    $row_countintThe number of rows exported

    Sample code

    /**
     * Log every successful scheduled export.
     *
     * @param array $feed      The Gravity Forms feed array.
     * @param int   $row_count The number of rows exported.
     */
    function gravityexport_log_scheduled_export( $feed, $row_count ) {
        error_log( sprintf(
            'GravityExport: feed %d on form %d exported %d rows.',
            $feed['id'],
            $feed['form_id'],
            $row_count
        ) );
    }
    add_action( 'gk/gravityexport/save/cron/completed', 'gravityexport_log_scheduled_export', 10, 2 );

    gk/gravityexport/save/cron/failed

    Applies to: Scheduled export runs (action, since 1.7.0)

    Fires after a scheduled export fails. Use it to alert someone or log the error. GravityExport catches anything your listener throws so it cannot hide the original failure, and the feed’s Activity Log and Failure Alerts still record the run.

    PropertyTypeDescription
    $feedarrayThe Gravity Forms feed array
    $e\ThrowableThe error or exception that caused the failure

    Sample code

    /**
     * Email the site admin when a scheduled export fails.
     *
     * @param array      $feed The Gravity Forms feed array.
     * @param \Throwable $e    The error or exception that caused the failure.
     */
    function gravityexport_notify_export_failed( $feed, $e ) {
        wp_mail(
            get_option( 'admin_email' ),
            sprintf( 'GravityExport: scheduled export failed for feed %d', $feed['id'] ),
            $e->getMessage()
        );
    }
    add_action( 'gk/gravityexport/save/cron/failed', 'gravityexport_notify_export_failed', 10, 2 );

    gk/gravityexport/save/exported/manual

    Applies to: Runs started with Export Now on the feed list, or through the save-feed action below (action, since 1.6.0)

    Fires after a manually triggered export completes. It does not fire for scheduled, webhook, or entry-triggered runs.

    PropertyTypeDescription
    $feedarrayThe Gravity Forms feed array

    Sample code

    /**
     * Log manual export runs.
     *
     * @param array $feed The Gravity Forms feed array.
     */
    function gravityexport_log_manual_export( $feed ) {
        error_log( sprintf( 'GravityExport: feed %d was exported manually.', $feed['id'] ) );
    }
    add_action( 'gk/gravityexport/save/exported/manual', 'gravityexport_log_manual_export' );

    gk/gravityexport/save/action/save-feed

    Applies to: Your own code (an action you call, since 1.15.0)

    Call this action to run a Save feed on demand, for example from a WP-CLI command, a custom REST endpoint, or a WP Crontrol event. The feed must be an All Entries feed with a Scheduled or Webhook trigger; feeds set to Automatic are ignored. When the run succeeds, gk/gravityexport/save/exported/manual fires.

    PropertyTypeDescription
    $feed_idintThe ID of the Save feed to run

    Sample code

    /**
     * Run Save feed 42 right now, for example from a custom WP-CLI command.
     */
    do_action( 'gk/gravityexport/save/action/save-feed', 42 );
    Still stuck? How can we help?

    How can we help?

    "*" indicates required fields

    This field is for validation purposes and should be left unchanged.
    Replies will go to this email.
    How can we help?*
    My pre-sale question is related to...*
    My WordPress skills are....*
    My Gravity Forms skills are...*
    You will be shown articles from our documentation.
    Vous pouvez nous écrire dans votre langue maternelle si c’est plus facile pour vous—nous nous occuperons de la traduction!
    Puedes escribirnos en tu idioma nativo si te resulta más fácil; ¡nosotros nos encargamos de la traducción!
    Sie können uns in Ihrer Muttersprache schreiben, wenn das für Sie einfacher ist – wir kümmern uns um die Übersetzung!
    U kunt ons in uw moedertaal schrijven als dat gemakkelijker voor u is — wij zorgen voor de vertaling!
    Du kan skrive til oss på ditt morsmål hvis det er enklere for deg — vi tar oss av oversettelsen!
    Du kan skriva till oss på ditt modersmål om det är lättare för dig — vi tar hand om översättningen!
    Você pode nos escrever em seu idioma nativo se for mais fácil para você — nós cuidaremos da tradução!
    Puoi scriverci nella tua lingua madre se ti è più facile — penseremo noi alla traduzione!
    Please provide as much detail as you're able; this helps us provide you with faster support.
    Drop files here or
    Accepted file types: jpg, jpeg, gif, png, tiff, pdf, bmp, zip, json, csv, xls, xlsx, Max. file size: 256 MB.
      Get better at Gravity Forms every Friday

      Was this page helpful?

      Table Of Contents
      • gfexcel_renderer_matrix
      • gfexcel_renderer_hide_row
      • gfexcel_renderer_columns_max_width
      • gfexcel_renderer_wrap_text
      • gfexcel_renderer_worksheet_title
      • gfexcel_renderer_disable_hyperlinks
      • gfexcel_output_rows
      • gfexcel_output_columns
      • gfexcel_output_search_criteria
      • gfexcel_output_sorting_options
      • gfexcel_field_checkbox_empty
      • gfexcel_field_date_format
      • gfexcel_combiner_glue
      • gfexcel_file_extension
      • gfexcel_file_extensions
      • CSV-Specific Filters
      • Advanced Filters
      • Actions
      • GravityExport Save hooks
      GravityKit
      • How to Build It
      • GravityKit vs competitors
      • Pricing
      • Products
      • Our Team
      • Our Values
      • Work With Us
      • Coupons
      Support
      • Support
      • Contact
      • Documentation
      • Scope of Support
      • Brand Guidelines
      • Privacy Policy
      • Terms of Service (“Terms”)
      I am a...
      • Nonprofit
      • Web agency
      • Small business owner
      • Web developer
      • Educational institution
      • WordPress freelancer
      • Startup founder
      • One-person agency
      Get notified of updates.

      We’re constantly improving GravityKit. Fill out your email below and we’ll notify you anytime major updates drop.

      • Facebook
      • Twitter
      • Mastodon
      GravityKit is a Gravity Forms Certified Developer.

      Copyright © 2026, Katz Web Services, Inc.

      GravityKit and GravityView are registered trademarks of Katz Web Services, Inc.