Support

Home Forums Event Espresso Premium Customize CSV Export

Customize CSV Export

Posted: March 1, 2019 at 12:38 pm

Viewing 17 reply threads


dafaguru1

March 1, 2019 at 12:38 pm

Hi there,

i’m wondering how to customize csv export.

We need the export like this:

https://abg-wuppertal.de/test-event-espresso/

thank you for helping us ๐Ÿ™‚


Josh

  • Support Staff

March 4, 2019 at 11:51 am

Hi,

You can follow this code example to include only a few selected columns for the regsitrations CSV report:

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

You can add, then modify to your specifications, the above code to a functions plugin.


dafaguru1

March 5, 2019 at 4:51 am

Hi Josh,

thank you!

This code works but i also need to display the custom questions (or all other columns) and answers for the registrants. how can i do that? what is the right code for phone number, adress etc.?

thank you!


Josh

  • Support Staff

March 5, 2019 at 9:30 am

Your screenshot did not specify that you also want to display custom questions. What you could do instead is remove the columns you don’t want to displayed. Here’s a different code snippet that you can use to remove specific fields/columns:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/tw_registration_report_exclude_fields.php


dafaguru1

March 6, 2019 at 5:07 am

Hey Josh, thank you ๐Ÿ™‚

but where do i find the names of the specific fields/columns so that i can write it down in this code snippet? For example: what is the name of phone number or adress?

is it like my example:

$fields_to_exclude_from_csv = array(
//Add the fields you wish to exclude from the CSV here.
//These excluded fields are an example of how to remove fields, your list will be different.
__( ‘phone number’, ‘event_espresso’ ),
__( ‘adress’, ‘event_espresso’ ),

);

???


Tony

  • Support Staff

March 6, 2019 at 5:11 am

It’s the name of the columns listed at the top of the CSV.

Export a CSV and view the column names here: https://monosnap.com/file/hu23Y3L5bMEAUscon5KBw0U2MqrDkL

Use the column name in the $fields_to_exclude_from_csv array and they will be excluded from the CSV.


dafaguru1

March 6, 2019 at 6:28 am

thanks tony!!!

last question ๐Ÿ™‚
how can i display the values per column in excel just like shown in your link?


Tony

  • Support Staff

March 6, 2019 at 6:53 am

That should happen automatically, what do you see?


dafaguru1

March 6, 2019 at 7:07 am

have a look:

https://abg-wuppertal.de/test-event-espresso/

it’s all in one column in excel ๐Ÿ™


Tony

  • Support Staff

March 6, 2019 at 7:48 am

That’s not an issue with Event Espresso, it looks like a list delimiter issue.

I’m assuming you’re in Germany so your list delimiter would be ; rather than a comma (,), is that correct?

If thats the case you can add this snippet to the site to swap out to delimiter used in the CSV to be a semi colon:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/tw_ee_set_csv_delimiter.php

That can go in the same functions plugin you created for the CSV filter.

Does it work then?


dafaguru1

March 6, 2019 at 1:35 pm

Tony, wow!

yes it works now!

thank you very much, you made my day ๐Ÿ™‚


Tony

  • Support Staff

March 6, 2019 at 3:07 pm

Great! I’m glad that worked ๐Ÿ™‚

Any further problems just let us know.


dafaguru1

March 7, 2019 at 8:40 am

Tony, sorry, got another problem…

i cannot remove every specific column that i want to. i integrated this code-snippet:

/*
Plugin Name: Exclude custom fields from EE registrations export. Description: Allows you to set felds that will be excluded from the registrations CSV export file.
Author: Tony Warwick Version: 1.0
*/
function ee_exclude_custom_fields_from_export($reg_csv_array, $reg_row) {

$fields_to_exclude_from_csv = array(
//Add the fields you wish to exclude from the CSV here.
//These excluded fields are an example of how to remove fields, your list will be different.
__( ‘Transaktions ID’, ‘event_espresso’ ),
__( ‘Teilnehmer ID’, ‘event_espresso’ ),
__( ‘Registrierungs-ID’, ‘event_espresso’ ),
__( ‘Time registration occurred’, ‘event_espresso’ ),
__( ‘Unique Code for this registration’, ‘event_espresso’ ),
__( ‘Registrations share of the transaction total’, ‘event_espresso’ ),
__( ‘Transaktionsstatus’, ‘event_espresso’ ),
__( ‘Transaction Amount Due’, ‘event_espresso’ ),
__( ‘Bezahlter Betrag’, ‘event_espresso’ ),
__( ‘Zahlungseingang’, ‘event_espresso’ ),
__( ‘Zahlungsart’, ‘event_espresso’ ),
__( ‘Gateway Transaction ID(s)’, ‘event_espresso’ ),
__( ‘Check-Ins’, ‘event_espresso’ ),
__( ‘Ticketname’, ‘event_espresso’ ),
__( ‘Address Part 1’, ‘event_espresso’ ),
__( ‘Payment Date(s)’, ‘event_espresso’ ),
__( ‘Payment Method(s)’, ‘event_espresso’ ),
__( ‘Gateway Transaction ID(s)’, ‘event_espresso’ ),
__( ‘Wรคhrung’, ‘event_espresso’ ),
__( ‘Stadt’, ‘event_espresso’ ),
__( ‘Land’, ‘event_espresso’ ),
__( ‘PLZ’, ‘event_espresso’ ),
__( ‘Address Part 2’, ‘event_espresso’ ),
__( ‘Bundesland’, ‘event_espresso’ )
);

foreach( $fields_to_exclude_from_csv as $single_field_to_exclude ) {
//For each field within $fields_to_exclude_from_csv, check if that value is within the CSV array.
if ( array_key_exists( $single_field_to_exclude, $reg_csv_array )) {
//If the field is set remove it from the array.
unset( $reg_csv_array[$single_field_to_exclude] );
}
}

this link will show you which csv export is generated:

https://abg-wuppertal.de/test-event-espresso/

so, “Wรคhrung” is removed but many other columns are still available in the csv export like “Transaktions ID” or “Teilnehmer ID”, “Registrierungs-ID”, “Unique Code for this registration” and so on…

what can i do now?

Thank you again ๐Ÿ™‚


Tony

  • Support Staff

March 7, 2019 at 8:55 am

Please post your code to a service like Pastebin and then add the URL here, the form adds formatting and I then can’t be sure if it’s the forum or your code.

Also the above is missing the filter, can you add the full code you are using, please.


dafaguru1

March 8, 2019 at 6:47 am

Hey Toni,

here is the link:

https://pastebin.com/DFQnPas3

the csv export hides “Wรคhrung” but not “Transaktions ID”, you can see the export here:

https://abg-wuppertal.de/test-event-espresso/

We do only need the yellow columns for our csv export.

Thank you a lot!!


Tony

  • Support Staff

March 8, 2019 at 7:53 am

Ok, the strings must match exactly, so check there are no spaces before/after the title in the CSV that isn’t being added to the titles in your code.

Also change the filter from this:

FHEE__EE_Export__report_registrations__reg_csv_array

To this:

FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array


dafaguru1

March 8, 2019 at 1:46 pm

Hi,

perfect, it works now, i’m very happy ๐Ÿ™‚

thank you very much, your support is really, really great!!

have a nice weekend!

greets from germany


Tony

  • Support Staff

March 11, 2019 at 5:14 am

I’m glad it’s now working ๐Ÿ™‚

I’ll mark this thread resolved, any further questions please feel free to open up another.

Viewing 17 reply threads

The support post ‘Customize CSV Export’ 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