CSV Import

The CSV Import Admin Screen provides the ability to import any or all of the plugin’s data tables (Custom Post Types): Schedules, Teams, Games, Sports, and Venues, as shown in the screenshot below. Choose the file to be imported from your local machine, and press the corresponding Import button. The system will spin silently for a bit, then output the results of the import. Be patient! It could take a 10 or 20 seconds for large files. Depending on your web server’s settings, the import could time out for very large files. If this occurs, split the CSV file into a set of smaller files. (Be sure to include a header row in each.)

SS CSV Import Screen


Games-Select Schedule to Import
If you are importing only one team’s schedule, and you do not want to add the game_sched_id column to your CSV file, this control allows you to specify the schedule to import. Games with an empty game_sched_id field will be imported to the selected schedule. If that column is not in the CSV file at all, all games will be imported to the selected schedule.

Team Logos
If the Move Team Logos checkbox is checked the team logo files (as specified in the team_logo and team_alt_logo columns) will be moved from the specified locations to the Media Library of a new site. If the checkbox is not checked, the logo files will not be moved, even if the logo columns are populated, normally because they already exist in the site’s Media Library. (This functions exactly like the player photos in the Team Rosters CSV import.)

Slugs (for all data types)

  • Creating Slugs. Each CSV file has a has a ‘slug’ column. A post slug is normally the post title, all lower case, with spaces replaced by hyphens and punctuation removed. For example, by default a game titled “Cal vs. Stanford” has a slug of “cal-vs-stanford”. Simple enough, but you can change the slug if you like. The slug column is created automatically in MSTW CSV Exports, but you do not need that column if you are creating a CSV file from another source. The slug will default as described in this paragraph and the next.
  • Unique Slugs. Each slug is unique (to a specific site, not globally). So if you try to add a second game with the title “Cal vs. Stanford”, it will be assigned a slug “cal-vs-stanford-1”, and a third will be “cal-vs-stanford-2”. WordPress will not allow the creation of multiple posts with the same slug. You can’t do it, and you shouldn’t want it to happen.
  • Duplicate Items. If you import data items with the same title field and/or slug field, WordPress will change the slug as described above. All the other data will be unchanged, but now you will have two data items with the same title but different slugs. This may be fine if, for example, one game is basketball and the other is baseball. However, I would recommend using descriptive titles, for example, “2014 Cal-Stanford Basketball” and “2015 Cal-Stanford Baseball”, then you will have an easier time sorting things out on the All Games admin screen. There are a number of ways to organize large numbers of games to simplify sorting and searching. Some are discuss in a video tutorial available to Gold Support members. Note that this behavior also applies to image file names in the Media Library.

File Formats.
See the CSV File Formats page for more information.

Game Dates & Times. When Games are exported to a CSV file via the MSTW CSV Exporter plugin, the game date & time is exported to the game_unix_dtg column as a UNIX timestamp. This timestamp is not human-readable (although it can be created with a little Excel code). If you are creating a CSV file for games in Excel, say, you can enter the game date and time in the game_dtg column in the following format: 12/7/2014 13:05. If you are using Excel, be sure the game_dtg column with the dates and times in it is formatted as TEXT, NOT GENERAL. If you use General or one of Excel’s Date formats, a number will be saved in the CSV file, NOT the actual string you entered, and the import will not work correctly.