How To Export User’s Custom Fields in CSV or XLSX

Probably the easiest way to do this is to connect to the database using MySQL Workbench or similar, and extract the data using a SQL query e.g.

select u.user_login, u.user_email,
       m1.meta_value as first_name, m2.meta_value as last_name,
       m3.meta_value as billing_codice_snep,
       m4.meta_value as codice_snep
  from wp_users u
  left join wp_usermeta m1 on m1.user_id = u.id and m1.meta_key = 'first_name'
  left join wp_usermeta m2 on m2.user_id = u.id and m2.meta_key = 'last_name'
  left join wp_usermeta m3 on m3.user_id = u.id and m3.meta_key = 'billing_codice_snep'
  left join wp_usermeta m4 on m4.user_id = u.id and m4.meta_key = 'codice_snep'

and then you can use Workbench’s export to save this as a CSV or XLSX.

I’m guessing that you have called your user meta fields ‘codice_snep’ and ‘billing_codice_snep’. If not, you’ll have to change the last two lines of the query with the correct user meta keys.