<\/use><\/svg><\/div><\/a><\/div><\/p>\nLog into Spiceworks and ensure you see your data in Spiceworks<\/p>\n<\/div>\n
Once you’re comfortable with the results you can import all your purchases using this method. Please test this first with only a few purchases to check the format of the CSV file.<\/p>\n
Also remember to backup your database before you start!!<\/p>","step":[{"@type":"HowToStep","name":"Backup Your Spiceworks Database","text":"\n\n\nGo to Settings -> Backup Configuration.\nThen click the \"Backup Now\" button.","image":"https://us1.discourse-cdn.com/spiceworks/original/4X/b/2/4/b2414423bf45b8e1c72976c5f272b7a1bab7bdd2.png"},{"@type":"HowToStep","name":"Copy The Import Script","text":"\n\n\nUsing Windows Explorer navigate to C:\\Program Files\\Spiceworks\\pkg\\gems (replace Program Files with the location where Spiceworks is installed)\n\nBrowse into the directory spiceworks-x.x.xxxx (choose the latest version you see listed. For eg: at the time I'm writing this how-to the latest version is spiceworks-5.0.60009)\n\nYou'll see a file bulk_purchase_import.rb in this directory. Copy this file to C:\\Program Files\\Spiceworks\\bin (again replace Program Files with the location of your install)","image":"https://us1.discourse-cdn.com/spiceworks/original/4X/1/7/d/17dc61b1149da2fc258473e025a19f791bce7035.png"},{"@type":"HowToStep","name":"Open Command Prompt","text":"\n\n\nOpen a command prompt window and navigate to the C:\\Program Files\\Spiceworks\\bin directory (replacing Program Files with the right location)","image":"https://us1.discourse-cdn.com/spiceworks/original/4X/7/b/4/7b412c2ed9b015c69250cfafad97919066002e8a.png"},{"@type":"HowToStep","name":"Run The Bulk Import Script","text":"\nThe usage of the script is as follows:\nC:\\Program Files\\Spiceworks\\bin>ruby bulk_purchase_import.rb -h\n\nUsage: bulk_purchase_import.rb [options] \n - creates purchases in Spiceworks from a CSV file\n Options:\n -e, --email [EMAIL] email address to log into Spiceworks\n -p, --password [PASS] password for email address\n -s, --server [SERVER] Spiceworks server to import purchases to\n - default 'localhost'\n -P, --port [PORT] the Spiceworks server port\n - default '80'\n -c, --encoding [ENCODING] Encoding of CSV file\n - default UTF-8 or UTF-8 (detected)\n -d, --cdw CSV file is a CDW export\n -r, --received Mark purchases as received on the same date they are marked as purchased\n -o, --override Import CDW entry even if duplicate entry is found on the same date\n -?, --help show this message\n -V, --[no-]verbose flag to enable/disable verbose output\n -v, --version show version\n\nFor example: If you have Spiceworks running on port 9675 and the computer spiceserver with login [email protected] and your csv file is purchaselist.csv your command line will look like:\n\nruby bulk_purchase_import.rb -e [email protected] -p password -s spiceserver -P 9675 purchaselist.csv\n\nChange the parameters as appropriate. You'll see a message for each import like this:\n\nLogging into Spiceworks...\nImporting purchases...\n- imported purchase Toner\n- imported purchase Laptop\n- imported purchase Keyboard\n\n\nImport complete\n3 purchase entries processed: 3 imported, 0 duplicates ignored, 0 errors\n\ngoodbye!\n"},{"@type":"HowToStep","name":"Verify That Your Data Was Imported","text":"\n\n\nLog into Spiceworks and ensure you see your data in Spiceworks","image":"https://us1.discourse-cdn.com/spiceworks/original/4X/b/4/b/b4bf7d4d3ad7d710b7c6ad647d05e360f37d5bd2.png"}]}
This How-To shows how to use a script to import purchases into Spiceworks (version 5.0.60009 or later).
Be sure to backup your database before you start!
You’ll need a CSV file with the purchases you’d like to import. For the first import, start with a small file of 2-3 lines so you can test your CSV.
The first line of the CSV needs to be the names of the columns, for example:
name,quantity,price,created_at,part_number,purchase_order,charge_to
Toner,2,45.95,2010-11-01,123-45-6789,IT-639,IT
Laptop,1,1499.99,2010-10-31,987-654-321,E-639,Executive
Keyboard,1,25.95,2010-11-01,K12312,S-639,Sales
Note: The CSV file must include at least the “name” column in order to create purchases.
The following columns are available:
name
quantity
price
purchased - 0 or 1
purchased_at - Date
ticket_id
created_at - Date
received - 0 or 1
received_at - Date
approved - 0 or 1
approved_at - Date
charge_to
vendor - name of vendor (IT Service) that already exists in Spiceworks
order_number - Vendor’s Order Number
part_number
purchase_order - PO number
notes
shipping_code - Shipper tracking number
purchased_for_name - name of device, user, etc. that this item was purchased for (should already exist in Spiceworks)
Step 1: Backup Your Spiceworks Database
Go to Settings → Backup Configuration.
Then click the “Backup Now” button.
Step 2: Copy The Import Script
Using Windows Explorer navigate to C:\Program Files\Spiceworks\pkg\gems (replace Program Files with the location where Spiceworks is installed)
Browse into the directory spiceworks-x.x.xxxx (choose the latest version you see listed. For eg: at the time I’m writing this how-to the latest version is spiceworks-5.0.60009)
You’ll see a file bulk_purchase_import.rb in this directory. Copy this file to C:\Program Files\Spiceworks\bin (again replace Program Files with the location of your install)
Step 3: Open Command Prompt
Open a command prompt window and navigate to the C:\Program Files\Spiceworks\bin directory (replacing Program Files with the right location)
Step 4: Run The Bulk Import Script
The usage of the script is as follows:
C:\Program Files\Spiceworks\bin>ruby bulk_purchase_import.rb -h
Usage: bulk_purchase_import.rb [options]
creates purchases in Spiceworks from a CSV file
Options:
-e, --email [EMAIL] email address to log into Spiceworks
-p, --password [PASS] password for email address
-s, --server [SERVER] Spiceworks server to import purchases to
- default ‘localhost’
-P, --port [PORT] the Spiceworks server port
- default ‘80’
-c, --encoding [ENCODING] Encoding of CSV file
- default UTF-8 or UTF-8 (detected)
-d, --cdw CSV file is a CDW export
-r, --received Mark purchases as received on the same date they are marked as purchased
-o, --override Import CDW entry even if duplicate entry is found on the same date
-?, --help show this message
-V, --[no-]verbose flag to enable/disable verbose output
-v, --version show version
For example: If you have Spiceworks running on port 9675 and the computer spiceserver with login jsmith@acme.com and your csv file is purchaselist.csv your command line will look like:
ruby bulk_purchase_import.rb -e jsmith@acme.com -p password -s spiceserver -P 9675 purchaselist.csv
Change the parameters as appropriate. You’ll see a message for each import like this:
Logging into Spiceworks…
Importing purchases…
imported purchase Toner
imported purchase Laptop
imported purchase Keyboard
Import complete
3 purchase entries processed: 3 imported, 0 duplicates ignored, 0 errors
goodbye!
Step 5: Verify That Your Data Was Imported
Log into Spiceworks and ensure you see your data in Spiceworks
Once you’re comfortable with the results you can import all your purchases using this method. Please test this first with only a few purchases to check the format of the CSV file.
Also remember to backup your database before you start!!
35 Spice ups
It will be implemented in to GUI in the next version? (Select the file, import)
Congratulations abou this feature
emersonleal
(Emerson Leal)
December 10, 2010, 10:24am
3
Very nice how-to, thanks!
Nice, works like a charm. Now I can import all my purchases at the end of the month, instead of everyday. (Due to the inability to change the date) We only keep track of three or four purchase items on Spiceworks, so we’re inputting an average of 10-15 purchases a month.
If it becomes incorporated somehow in the GUI, it would be even more awesome.
jim
(Jim Kubicek)
January 17, 2012, 6:07pm
5
Nice! Thanks Eric, I’ll have to incorporate this into my SpiceU classes.
Thanks for the how-to eric. This works best when combined with the inventory pool post you made using purchase lists. We buy large quantities of items… (for example, 40 desktop ups batteries) and were disappointed that you had to enter each individually to track still. Importing all 40 from a spreadsheet is a breeze!
Any plans to update this so you can include categories, sub-categories and custom attributes?
zaphois13
(Zaphoid)
October 21, 2014, 2:35pm
8
OK Can some tell me why I keep getting the
Error: bad user ‘email@email.com’ or password for server ‘localhost.’ on port 88
Error. I have tried 4 different users plus created a new user just for this to see if I had something else wrong and get the same error.
Is this still the best way to import purchases? This was written in 2010. I found this newer article but the link for importing is still referencing this thread.
https://community.spiceworks.com/help/Importing_Data