0

I have webform submissions and want to download all its data with one click download button. Right now it show other options like below:

enter image description here

But I want only a single download button for this. Is there any way to achieve this?

0

I have added a "Quick Download" button with my custom module.

Quick Download button

Create a custom module. Add this in the hook_menu in your .module file.

$items['node/%webform_menu/webform-results/quick-download'] = array(
    'title' => 'Quick Download',
    'page callback' => 'generic_webform_results_quick_download',
    'access callback' => 'webform_results_access',
    'page arguments' => array(1),
    'access arguments' => array(1),
    'file' => 'includes/webform.report.inc',
    'weight' => 7,
    'type' => MENU_LOCAL_TASK,
);

Create a file includes/webform.report.inc in your module folder and add the below function.

function generic_webform_results_quick_download ($node) {
    module_load_include('inc', 'webform', 'includes/webform.report');
    module_load_include('inc', 'webform', 'includes/webform.export');
    $export_info = webform_results_export($node, 'delimited', array('delimiter' => ','));
    $export_info['exporter'] = webform_export_create_handler($export_info['format'], $export_info['options']);
    webform_results_download($node, $export_info);
}

Clear CMS cache, go to the "Results" tab of the webform, you will see the "Quick Download" option. This downloads the data in CSV format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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