Hi @valentinanamorphik,
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 request
has a priority lower than 10
as 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 5 years, 8 months ago by
Doeke Norg. Reason: Forgot the url