How to load phpspreadsheet for excel exports

The amr-users-plus export to excel feature uses the phpoffice/phpspreadsheet library. The library must be accessible on the server. Here are two ways to make it available:

Option 1: the easy low tech way: use the plugin cbxphpspreadsheet

Add the plugin https://github.com/codeboxrcodehub/cbxphpspreadsheet to your wordpress installation. The plugin does not need to be active, it.only needs to exist in your wordpress plugins folder. It may be safer to activate the plugin so that you don’t accidental delete it thinking it is not in use.

The amr-users-plus plugin will check for it’s code and load the necessary files if the files are found. Then in the plugin list settings, simple tick the checkbox to show the ‘export to xls’ option in the lists you want.

Option 2: use composer to load the spreadsheet.

if you have the composer dependency manager available to you, follow the instructions on the phpspreadsheet documentation. Many hosts like mine make composer available. I have used icdsoft since well before 2009. Basically on the command line type:

composer require phpoffice/phpspreadsheet

If you want to install composer, please see instructions available on the internet, such as:

If that all looks too hard, please see option 1 above.

The amr-users-plus plugin will look for phpspreadsheet as follows:

It first looks for the composer files: 

dirname(ABSPATH).'/vendor/autoload.php' 

and uses that if found.  If that is not found, then it looks for

WP_PLUGIN_DIR.'/cbxphpspreadsheet/lib/vendor/autoload.php' ;   

The amr-users-plus XLS export feature will not function if phpspreadsheet and the writer class are not found. It will give you an error message instead.