Import Games from CSV

CSV Format

Your CSV file should have the following columns:

title,platform,format,genres,completion_status,user_rating,condition,price_paid,location,digital_store,date_added,notes

Required fields: title, platform, format

Platform: Use the full name or abbreviation (e.g., "Nintendo 64" or "N64")

Format: Either "physical" or "digital"

Genres: Separate multiple genres with | (e.g., "Action|Adventure")

Completion Status: backlog, currently_playing, completed, on_hold, not_playing

User Rating: Number from 1 to 5

Condition (physical only): cib, loose, sealed, good, fair

Date Added: YYYY-MM-DD format (defaults to today if not provided)

Example CSV:

title,platform,format,genres,completion_status,user_rating,condition,price_paid,location,digital_store,date_added,notes
The Legend of Zelda: Ocarina of Time,N64,physical,Action|Adventure,completed,5,cib,45.00,Shelf A,,2024-01-15,One of the best games ever
Elden Ring,PS5,digital,Action|RPG,currently_playing,5,,,PlayStation Store,2024-03-01,Amazing open world

Upload CSV File

<%= form_with url: bulk_create_games_path, multipart: true, class: "space-y-4" do |f| %>
<%= f.label :csv_file, "Select CSV File", class: "block text-sm font-medium text-gray-700 mb-2" %> <%= f.file_field :csv_file, accept: ".csv", required: true, class: "block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100" %>
<%= f.submit "Import Games", class: "px-6 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700" %> <%= link_to "Cancel", games_path, class: "px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300" %>
<% end %>