title: Importing Excel CSV to MySQL relational database?
body: <p>I have two tables <code>baskets</code> and <code>fruits</code>; a <code>basket</code> has many different <code>fruits</code> so it's a one to many relation.</p>
  
  <p>The tables are as follows:</p>
  
  <pre><code>baskets 
  id NOT NULL PRIMARY KEY AUTO_INCREMENT,
  basket_name varchar(20)
  
  fruits 
  id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  fruit_name varchar(20),
  basket_id INT FOREIGN KEY REFERENCES baskets(id)
  </code></pre>
  
  <p>I have an Excel sheet with column names and data organized like this:</p>
  
  <pre>
  Basket Fruits 
  
  Basket_1 Apple, Mango, Banana, Pear
  
  Basket_2 Mango, Strawberry, Plums, Banana, Grapes
  
  Baskt_3 Raspberry, Apple, Pear
  </pre>
  
  <p>What would be the best possible way to store all these fruits for a single basket in the relational architecture modeled above?</p>
  
  <p>I have converted my XLS file to CSV for better parsing using scripts (in Ruby) and found that the table has been messed up such that each fruit is now in a separate cell and the number of cells vary for one basket (in a row) in the spreadsheet. </p>
  
  <p>My question is some what similar to this: <a href="https://stackoverflow.com/questions/4933544/import-excel-data-to-relational-tables-at-mysql">Import Excel Data to Relational Tables at MySQL</a>  </p>
  
  <p>But not the same in data. </p>
  
  <p>All suggestions are welcome! </p>