Support

Home Forums Event Espresso Premium CSV Export – Modifying the Output

CSV Export – Modifying the Output

Posted: December 11, 2019 at 12:25 pm


iowacpr

December 11, 2019 at 12:25 pm

I’ve browsed a few topics on modifying the CSV file that generates when exporting registrations in an event but it looks like most of the github links no longer work. What I’m specifically looking for is to modify the file to be identical to this template while maintaining the headers.

The relevant EE-related columns would be First Name, Last Name, Email (optional), and Phone Number. The other columns with headers must still be there and the “Evaluation” column needs to be prefilled with “Successful” for each registrant.

Is this something that’s possible?

Thanks!


Tony

  • Support Staff

December 11, 2019 at 1:20 pm

Hi there,

A lot of the gist examples were moved to our code library and we have examples of modifying the output of the CSV here:

https://github.com/eventespresso/ee-code-snippet-library/tree/master/admin/registration-reports

So you want First Name, Last Name, Email (optional), and Phone Number to be populated from EE and the other columns are simply place holders? (Yes, including the Evaluation column even though you want it prefilled)

I’m curious, how is Email option here? EE requires an email address so I’m not sure how it would be optional?


iowacpr

December 11, 2019 at 1:25 pm

Sorry for not being clear, but I was referencing the specific column names in the example sheet I linked. Email is obviously not optional when registering.


iowacpr

December 11, 2019 at 1:30 pm

And to answer your other question, your understanding of my need is good. I need the report to reflect that template sheet I linked and include all headers and placeholders.


Tony

  • Support Staff

December 11, 2019 at 3:38 pm

In that case, you just need a snippet like this:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/registration-reports/core/tw_ee_registration_report_limit_columns_shown.php

Set your $allowed_fields_in_order array to something like this:

$allowed_fields_in_order = array(
    __('Last Name', 'event_espresso'),
    __('First Name', 'event_espresso'),
    __('Email Address', 'event_espresso'),
    __('Phone', 'event_espresso'),
    'Evaluation (see instructions, data entered must match evaluation options)',
    'Reason if unsuccessful or not evaluated (see instructions, data entered must match an item from the list)',
    'Additional Information (optional)'
);

The fields set in that array are the ‘columns’.

EE then uses those fields as keys and if it finds answers related to those field provides a value.

Right before this line:

return $filtered_csv_row;

Add something like:

$filtered_csv_row['Evaluation (see instructions, data entered must match evaluation options)'] = 'Successful';

That will prefill that column for each registrant.

You can add that to a custom functions plugin on your site, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


iowacpr

December 12, 2019 at 7:59 am

Thank you so much for your help! You just saved my staff precious time when importing our classes into our other software program. I will continue to recommend Event Espresso to anyone who needs registration software!

The support post ‘CSV Export – Modifying the Output’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso