GravityExport Lite for Gravity Forms Shortcode

Below, you’ll find a detailed guide on how to add the GravityExport Lite for Gravity Forms Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the GravityExport Lite for Gravity Forms Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the GravityExport Lite for Gravity Forms Plugin and the shortcodes it provides:

Plugin Icon
GravityExport Lite for Gravity Forms

"GravityExport Lite for Gravity Forms is a WordPress plugin that simplifies the process of exporting Gravity Forms entries into Excel. Useful for data analysis, backup, or record-keeping."

★★★★★ (36) Active Installs: 10000+ Tested with: 6.3.2 PHP Version: 7.2
Included Shortcodes:
  • [gfexcel_download_url]

GravityExport Lite [gfexcel_download_url] Shortcode

The GF Entries in Excel plugin shortcode, ‘gfexcel_download_url’, generates a URL for downloading Gravity Form entries in an Excel format. This shortcode requires an ‘id’ argument, representing the form’s ID. If the ‘id’ is not provided or doesn’t exist, it returns an error. The optional ‘type’ argument specifies the download format.

Shortcode: [gfexcel_download_url]

Parameters

Here is a list of all possible gfexcel_download_url shortcode parameters and attributes:

  • id – Unique identifier for the required form.
  • type – Specifies the type of the form, optional parameter.

Examples and Usage

Basic example – A simple usage of the shortcode to download Excel data for a Gravity Form with a specific ID.

[gfexcel_download_url id=1 /]

Advanced examples

Using the shortcode to download Excel data for a Gravity Form by specifying both the form ID and the type of data to be downloaded. If no type is specified, the default type will be used.

[gfexcel_download_url id=1 type="entries" /]

Using the shortcode to download Excel data for a Gravity Form by specifying the form ID. If the form with the specified ID does not exist, an error message will be returned.

[gfexcel_download_url id=999 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [gfexcel_download_url] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('gfexcel_download_url', [$this, 'handle']); // Backward compatible

Shortcode PHP function:

function handle($arguments)
    {
        if (!is_array($arguments)) {
            $arguments = [];
        }

        if (!array_key_exists('id', $arguments)) {
            return $this->error(sprintf('Please add an `%s` argument to \'%s\' shorttag.', 'id', self::SHORTTAG));
        }

        if (!\GFAPI::form_id_exists($arguments['id'])) {
            return $this->error(sprintf('Form id not found for \'%s\' shorttag.', self::SHORTTAG));
        }

        return $this->getUrl($arguments['id'], $arguments['type'] ?? null);
    }

Code file location:

gf-entries-in-excel/gf-entries-in-excel/build/vendor_prefixed/gravitykit/gravityexport-lite-src/Shorttag/DownloadUrl.php

Conclusion

Now that you’ve learned how to embed the GravityExport Lite for Gravity Forms Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *