Thanks to ‘dvkob’ for the great [CSVImporter plugin](http://wordpress.org/extend/plugins/csv-importer/). I simplified this pluging (greatly) for this specific use. Team Rosters can be imported via this plugin, but the roster format in Excel would change dramatically from what one would normally view. I also include and use the File_CSV_Datasource class by Kazuyoshi Tlacaelel exactly as it was found in the CSV Importer plugin. All their GNU/MIT copyrights are passed through.
Since version 2.0 team rosters can be loaded from files in CSV format. This allows admins to load their team roster(s) from an Excel spreadsheet, which is often used to create printed rosters. However, some rules apply. Sample CSV files are available in the plugins /csv-examples directory. I recommend you get these examples to work, then modify them for your own needs. The CSV Roster Import Admin Screen is shown below.
The Team must exist in the Teams taxonomy before the roster can be uploaded. Note that hierarchical entries are not supported. Create the team using the Players->Teams screen. [All teams are at the top level of the taxonomy, for example, teams->baseball->giants does not work.]
The following field names may appear in the top row of the CSV table and will be mapped as follows:
CVS Column Header -> Database Field
“First Name” or First” -> first_name
“Last Name”, “Last” -> last_name
“Position”, “Pos” -> position
“Number”, “Nbr”, “#” -> number
“Weight”, “Wt” -> weight
“Height”, “Ht” -> height
“Age” -> age
“Year” -> year
“Experience”, “Exp” -> experience
“Home Town” -> home_town
“Country” -> country
“Last School” -> last_school
“Bats”, “Bat” -> bats
“Throws”, “Thw”, “Throw” -> throws
“Bio” -> player bio (post content field)
- The (player) post title will be first_name last_name, so it is important that at least one of First Name and Last Name fields be present. For privacy of younger players, it is certainly possible to use fictitious last names, say First->”Lara L.”, Last->”Giants” and First->”Lara M.”, Last->”Giants”, and then only display the first name. The title would then be “Lara M. Giants”, but the psot title does not appear anywhere on the front end (user end).
- The player slug will be first-last, so it is important that at least one of First Name and Last Name fields be present.
- The “Bio” field/column will be stored in the post’s content field.
- Capitalization is not important. So “Ht” and “HT” both are mapped to height.
- Missing fields are ignored.