This plugin imports posts from CSV (Comma Separated Value) files into your WordPress blog. It can prove extremely useful when you want to import a bunch of posts from an Excel document or the like – simply export your document into a CSV file and the plugin will take care of the rest.
Step 1. Download and install
In your administration dashboard go to Plugins > Add New > Search Plugins. Search for CSV Importer.
Click Install Now.
Access the plugin from the Dashboard by going to Tools > CSV Importer
Click the check box to import the file as a draft or all the articles will be automatically published (although you may want that)
Select a category to upload them to.
Browse and upload the CSV file
This part is all very simple to understand. The hard part is preparing the file for import. If you don’t have it done correctly it won’t import correctly. Do it right, and you can not only upload the file, but create new categories, fields and taxonomies if they aren’t already created.
It starts with preparing a spreadsheet, and then saving it as a CSV file. The two most popular programs for this are Microsoft Excel and Open Office Calc.
NOTE: Some spreadsheet programs do not save CSV files the same as others. You may run into a problem with punctuation or other special characters in a text field when you upload. Open Office Calc has always worked properly for me. If you are having problems, you can download it for free from http://www.openoffice.org/ and give that a try.
Step 2. Prepare the spreadsheet.
Your spreadsheet should look like the sample above.
On your spreadsheet, every line will be a different page or post. Every column will be a part of the post. The import program will import one line at a time, and will distribute the information in the columns based on what titles you have at the top of the spreadsheet. So first you need to know what columns to put at the top.
Here is the list of possible columns to use, which is also available on the plug in page.
These titles need to be in the top row of your spreadsheet. All lower case, with the underscores between words. You don’t need to put all of them in there if you are just going to import titles, with post body content, and tags, you can just create a spreadsheet with three columns. This can be as simple or complex as you need it.
- WordPress pages don’t have categories or tags. but posts do.
- Most columns are optional. Either csv_post_title, csv_post_post or csv_post_excerpt are sufficient to create a post. If all of these columns are empty in a row, the plugin will skip that row.
- The plugin will attempt to reuse existing categories or tags; if an existing category or tag cannot be found, the plugin will create it.
- To specify a category that has a greater than sign (>) in the name, use the HTML entity >
Basic post information – use these as the column headers in the first row of your spreadsheet
- csv_post_title – title of the post
- csv_post_post – body of the post
- csv_post_type – post, page or a custom post type. New in version 0.3.2 In prior versions, importing rows as pages could be specified on a per-file basis using the plugins UI. In 0.3.2, csv_post_type column was added to support custom post types as well. Refer to the WordPress documentation on custom post types for more info on how to set up custom post types.
- csv_post_excerpt – post excerpt
- csv_post_categories – a comma separated list of category names or ids. New in version 0.3.5 It’s also possible to assign posts to non-existing subcategories, using > to denote category relationships, e.g. Animalia > Chordata > Mammalia. If any of the categories in the chain does not exist, the plugin will automatically create it. It’s also possible to specify the parent category using an id, as in 42 > Primates > Callitrichidae, where 42 is an existing category id.
- csv_post_tags – a comma separated list of tags.
- csv_post_date – about any English textual description of a date and time. For example, now, 11/16/2009 0:00, 1999-12-31 23:55:00, +1 week, next Thursday, last year are all valid descriptions. For technical details, consult PHP’s strtotime() function documentation.
Any column that doesn’t start with csv_ is considered to be a custom field name. The data in that column will be imported as a custom fields value.
- csv_post_author – numeric user id or login name. If not specified or user does not exist, the plugin will assign the posts to the user performing the import.
- csv_post_slug – post slug used in permalinks.
- csv_post_parent – post parent id.
Tip: Sample files
There are samples of the various types of spreadsheets you can use as starters for your own spreadsheets so you can get it right. If you need to view the samples they are located in /public_html/wp-content/plugins/csv-importer/examples You can download them using FTP or you can go to http://yourdomainname.com/wp-content/plugins/csv-importer/examples/ and you will be able to download them. I suggest you delete this directory after you download the samples, or add a blank index.html file for security.