Import/Export points from CSV file
MageRewards now allows you to import customer points from a CSV (comma-separated values) file. It is recommended that you import data in smaller chunks of 1,000 records or less.
To find this tool in the Magento admin, navigate to Rewards > Configuration > Other Configuration and expand Migration Utilities.
The CSV file you provide in this section must match one of the following formats:
1. The first line of the file has the headings indicated below, while the rest of the file has a value underneath the corresponding header for each customer:
- customer_id
- points_amount
A sample file following this format would look like this:
customer_id,points_amount 196,200 197,150 198,150 199,150 202,150
2. The first line of the file has the headings indicated below, while the rest of the file has a value underneath the corresponding header for each customer:
- customer_email
- [website_id]
- points_amount
customer_email,points_amount John@email.com,200 Alice22@gmail.com,150 customer225@ymail.com,150
customer_email,website_id,points_amount John@email.com,0,200 Alice22@gmail.com,1,150 customer225@ymail.com,1,150
In either format, headings can be in any order as long as the values on each line thereafter match the same ordering.
Important to note: With each import, the amount of points indicated in the import will be added to the total quantity, not replacing.
If you prefer to import points directly into your database, please follow the instructions in this article instead: Database Points Import Script
Deducting Points
If you want to deduct points using the import tool, use the same steps as above but insert the negative sign "-" in front of the quantity of points to deduct.
For example current points at customers account below:
customer_id,points_amount
5,100
2,700
3,50
6,250
4,50
7,200
If you want to deduct 50 points on all customer expect customer_id 7 which you want to deduct 100, you need to import a CSV file like the following:
customer_id,points_amount
5,-50
2,-50
3,-50
6,-50
4,-50
7,-100
The output in your Admin will be:
customer_id,points_amount
5,50
2,650
3,0
6,200
4,0
7,100
Exporting Points
If you're exporting points, you would have to do it through the Customer Points screen which is accessible from the MageRewards menu. Once there, use the export to CSV feature to export the points table into a CSV file.
Note that the CSV file you create in this section will not be compatible with the import tool right away. Open the file and change the column headers on the first line so that they match the headers required by the import tool (mentioned above). This should allow you to use the file again through the import tool.