Export wordpress users to csv using amr users plugin

The “amr users” plugin allows one to create a wide variety of user lists accessing as little or as much of the user data as you like. One can then export these views for further analysis and manipulation.

There are several ways to export users to csv using amr-users

  • Public csv export by stored file on server
  • Non public real time csv export, or
  • Non public real time  csv as .txt export (for excel users, to force the excel text import wizard to appear)
  • Filtered CSV export if using amr-users-plus, by filtering by some fields and then click the ‘CSV filter’ button near the apply filter and clear filter buttons.

The overview screen where user lists can be managed

‘Public’ lists csv export

  • will generate an actual file that can be downloaded
  • a export icon will appear at the bottom of the list (both front pages and admin pages)
  • the list has been ‘ticked’ as public in the overview screen
  • you may or may not have it available on a front page in a shortcode (just because it is ticked public, does not mean that the general public can access it – it must also be in a shortcode in a page
  • the csv file location is obfuscated (hidden, but accessible)
  • you should use good sense in deciding what data should be made available on that list

Non Public Lists

Admin (non public) csv or txt export users options

  • In  order to protect the user data, non public lists are only written to csv at request time.
  • The ‘file’ is sent generated and sent direct to your browser.  No file is stored on the server.
  • This non-stored file option may have implications for people who have magic quotes enabled on their server.

Non Public csv export as .txt file

  • For people who use excel and have troubles with double quotes in csv.
  • Will export the csv list as a .txt file to force excel to use the text import wizard to allow control over the import options


CSV Export, slashes, magic quotes on, security

To those using the user lists plugin and complaining about extra slashes, I apologise for not realising that it is because your host must have magic quotes enabled.  Please read the php link. The php manual says:  Relying on this feature is highly discouraged.

I have looked into it and it seems that because , with it enabled, php adds the slashes at the very last minute (when you click export cvs), there is no way I can stop it from kicking on.

The only possibility may be to write the csv to a file on the server.  I specifically do NOT want to do this for non public lists, because

  • it is user data and should be kept private, not written to a file on a public server
  • plugins cannot easily access ‘private’ folders to keep such a file private

So either you could try seeing if there is a way to switch it off at your host, or do a search and replace in the csv file, or make the list public (if this is ok with your users and your privacy agreement with them)

Ask your host to disable magic quotes ….Or try my very good hosts – they are reliable, helpful. We’ve been with them for more than 10 years now with no complaints.

Exporting a wordpress user list to a csv file and excel

A number of people using the amr-users plugin and who are Excel users, seem to need help when it comes to importing the csv file into excel.  Open Office and Google Docs users seem to be fine. [Please note that is also possible to offer an excel file export of your user list.]

As far as I can make out, the problems some people experience with loading csv files into excel seem to be because:

  1. their hosts might have magic quotes enabled.  Ask them to disable it!
  2. their default excel csv import settings do not match the csv file settings (comma separated, and all fields double quotes delimited – this is a standard csv usage.)
  3. they do not know how to get to the text import wizard (Office 2007 in particular is non obvious)  See screenshot below.

Office 2007

In Office 2007, it seems that the trick is to rename the file to a .txt file, instead of a .csv.  Excel 2007 should then automatically load the text import wizard.  You may find other benefits to, in being able to define how excel should handle the data in each column.

Note:   When Excel opens a .csv file, it uses the current default data format settings to interpret how to import each column of data. If you want more flexibility in converting columns to different data formats, you can use the Import Text Wizard. For example, the format of a data column in the .csv file may be MDY, but Excel’s default data format is YMD, or you want to convert a column of numbers that contains leading zeros to text so you can preserve the leading zeros. To run the Import Text Wizard, you can change the file name extension from .csv to .txt before you open it…

Using the Excel Text Import Wizard:

Get the text import wizard up

  • either opening from the menus (Office 2003 – Click Data → Get External Data) or
  • by renaming file to a .txt (Offfice 2007) and then double clicking on it
  • Choose delimited, Click next
  • Choose Delimiter: comma
  • Choose text qualifier: “, Click next,
  • Other options as you wish
  • Click Finish

Other resources: