Download all results of multiple forms
-
I want to download directly from the forms table without the url!
Allright! No need to yell! For those situation we’ve added a bulk option on the forms table.
As a bonus, you can select multiple forms, and it will download all results in one file,
on multiple worksheets (oohhh yeah!)Can I download all results in one file from all forms with a URL as on each form?
Thank you !
-
These is no native support for this. Reason is mostly because this is not really a much requested thing, and also security. When someone has this url, he or she has access to every entry, including forms that will be made in the future. I see this as a bad thing. That’s why I’m not keen on implementing this.
However, it’s possible to hack something together within a project. What kind of url are thinking about? Maybe I can help you get started on a private implementation.
Hi @doekenorg ,
Thank you for your reply.
We understand perfectly why you are not keen on implementing this in your project.
However, we need this export temporarily.We are developer, we can implement this feature in our project.
Example URL: https://www.mysite.com/gf-entries-in-excel/{token}?forms=all
Regards,
That particular url isn’t possible because a token references a specific form. But I got some ideas.
Let me get back to you on this.
I’ve hacked something together for you. This exports all active and untrashed forms into one excel on multiple sheets. You can refactor this to a nice class. Just make sure that the
requesthas a priority lower than10as to be earlier than the normal hook.// Quick and dirty, but does the trick. use GFExcel\GFExcel; use GFExcel\GFExcelOutput; use GFExcel\Renderer\PHPExcelMultisheetRenderer; add_action('request', function ($query_vars) { // only respond to a plugin call if (!array_key_exists(GFExcel::KEY_ACTION, $query_vars) || !array_key_exists(GFExcel::KEY_HASH, $query_vars) || $query_vars[GFExcel::KEY_ACTION] !== GFExcel::$slug) { return $query_vars; } // Set this super secret key to something only u know. $secret = 'super_secret'; if ($query_vars[GFExcel::KEY_HASH] !== $secret) { return $query_vars; } // instantiate multi sheet renderer and push all forms to it. $renderer = new PHPExcelMultisheetRenderer(); foreach (GFFormsModel::get_form_ids() as $form_id) { $output = new GFExcelOutput((int) $form_id, $renderer); $output->render(); } // start the rendering and the download. $renderer->renderOutput(); exit; }, 9);Hope this helps you out.
Edit: You can download this file by going to:
<your-url.ext>/gf-entries-in-excel/super_secret🙂-
This reply was modified 6 years, 10 months ago by
Doeke Norg. Reason: Forgot the url
@valentinanamorphik sure, no problem. Enjoy!
Hi @doekenorg,
Sorry to bother you again…
Is it possible to extract in a Excel single sheet?
Thanks !!
In theory you could do that. But we would need to build a MultiSingleSheetRenderer. That feels weird 😀.
That would be custom to your installation only. And I can’t promise much support for it.
I’ll take a look. Will get back to you on this.
Here you find a custom renderer:
https://gist.github.com/doekenorg/b7fdfca59a98e2d36ebca0785d333976You’ll need to save the file, and include it somewhere in your
functions.phpor add it to a location you know is autoloaded.NB. The styling is removed; can’t do much about that other than completely rewriting a renderer; and that idea sounds like no fun 🙂
Hope this helps you out.
That’s great !!
It’s correct ?
// include : https://gist.github.com/doekenorg/b7fdfca59a98e2d36ebca0785d333976 require 'MultiFormSingleSheetRenderer.php'; // Quick and dirty, but does the trick. use GFExcel\GFExcel; use GFExcel\GFExcelOutput; use GFExcel\Renderer\PHPExcelMultisheetRenderer; add_action('request', function ($query_vars) { // only respond to a plugin call if (!array_key_exists(GFExcel::KEY_ACTION, $query_vars) || !array_key_exists(GFExcel::KEY_HASH, $query_vars) || $query_vars[GFExcel::KEY_ACTION] !== GFExcel::$slug) { return $query_vars; } // Set this super secret key to something only u know. $secret = 'super_secret'; if ($query_vars[GFExcel::KEY_HASH] !== $secret) { return $query_vars; } // instantiate multi sheet renderer and push all forms to it. // $renderer = new PHPExcelMultisheetRenderer(); $renderer = new MultiFormSingleSheetRenderer(); foreach (GFFormsModel::get_form_ids() as $form_id) { $output = new GFExcelOutput((int) $form_id, $renderer); $output->render(); } // start the rendering and the download. $renderer->renderOutput(); exit; }, 9);Regards,
You need to save this page (https://gist.githubusercontent.com/doekenorg/b7fdfca59a98e2d36ebca0785d333976/raw/fb99c03e5dcf45fd5f39f55650aec71d954ff920/MultiFormSingleSheetRenderer.php) as
MultiFormSingleSheetRenderer.phpand store it in your installation.Then you include the file in your
functions.php:<?php // ... include_once "path/to/your/MultiFormSingleSheetRenderer.php";Then you change this
// instantiate multi sheet renderer and push all forms to it. $renderer = new PHPExcelMultisheetRenderer();to this:
// instantiate multi sheet renderer and push all forms to it. $renderer = new MultiFormSingleSheetRenderer();That should do the trick!
@valentinanamorphik sorry, I couldn’t see your post. It was missing, so I went on the message in the mail. That looked a bit different. But yes; that looks right enough. Is it working?
You can loose the
use GFExcel\Renderer\PHPExcelMultisheetRenderer;stament as you no longer use that.Hi @doekenorg ,
We have the entries of the first form but not the others (4 in total).
We have forms without entries yet. Maybe because of that?
Results : https://file.io/mwVSv3
-
This reply was modified 6 years, 10 months ago by
The topic ‘Download all results of multiple forms’ is closed to new replies.