<\/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 in your CSV file.<\/p>\n
Remember to use the -d option when importing.<\/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":"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":"Download your CDW purchases","text":"\n\n\nYou can export your CDW purchases using the CDW extranet:\n\n1. Login to the CDW extranet\n2. Go to your Order Histrory\n3. Run a report (filter as needed - start with 2 or 3 items the first time).\n4. Download as CSV","image":"https://us1.discourse-cdn.com/spiceworks/original/4X/1/2/c/12c357cd7f7afd30fb1ee745ca4eca5f49f62b88.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":"Run The Bulk Import Script using the \"-d\" option","text":"\nTo import CDW data, be sure to specify the \"-d\" option.\n\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\nOptions:\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 cdw_purchaselist.csv your command line will look like:\n\nruby bulk_purchase_import.rb -e [email protected] -p password -d -s spiceserver -P 9675 cdw_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\nImport complete\n3 purchase entries processed: 3 imported, 0 duplicates ignored, 0 errors\n\ngoodbye!"},{"@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 from CDW into Spiceworks (version 5.0.60009 or later).
Be sure to backup your database before you start!
You’ll need to export your CDW purchases from their extranet site into a CSV file. For the first import, start with a small file of 2-3 lines so you can test your CSV.
Step 1: Backup Your Spiceworks Database
Go to Settings → Backup Configuration.
Then click the “Backup Now” button.
Step 2: 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 3: Download your CDW purchases
You can export your CDW purchases using the CDW extranet:
Login to the CDW extranet
Go to your Order Histrory
Run a report (filter as needed - start with 2 or 3 items the first time).
Download as CSV
Step 4: 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 5: Run The Bulk Import Script using the “-d” option
To import CDW data, be sure to specify the “-d” option.
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 cdw_purchaselist.csv your command line will look like:
ruby bulk_purchase_import.rb -e jsmith@acme.com -p password -d -s spiceserver -P 9675 cdw_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 6: 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 in your CSV file.
Remember to use the -d option when importing.
Also remember to backup your database before you start!!
12 Spice ups
Nice, I’ll have to try this one
Thanks. Was justing getting to this need for setup, so will use and comment back!
This is really cool. Now it would be cooler to automate this by just entering your CDW credentials into spiceworks.
Works perfect, I was able to create my own CSV and import from multiple vendors. Thanks for the tip.
Are CDW reports still produced in the format this is expecting? Running Spiceworks 6.2 and the CDW Export / Import columns aren’t lining up.
I had to rewrite the bulk_purchase_import.rb files to match the new CDW format before mine would work
maenxe
(MaenXe)
July 26, 2013, 9:27pm
8
Jake1081, can you post your revised script? The stock script in 6.2 is giving an “Invalid column(s) in csv” error on a CDW exported csv.
Love it!
Import complete
792 purchase entries processed: 792 imported, 0 duplicates ignored, 0 errors
goodbye!
Thanks Eric!