title: Read data from excel file to postgres database (Active Record)
body: <p>I am building a web application that shows stock data trends and stock quotes. The data has been sent to me in an excel file and I now need to load it into the database. The excel file has daily stock data for each stock, with columns in this format:</p>
  
  <p>date | bid | offer | price | volume </p>
  
  <p>And each stock is in a separate work sheet in the file, as below, each block is a worksheet:</p>
  
  <p>Stock1 | Stock2 | Stock3 | Stock4</p>
  
  <p>What is the best way for me to load this data from the excel spreadsheet to my DailyQuotes table, the migration file for my DailyQuotes table is below:</p>
  
  <pre><code>class CreateDailyQuotes &lt; ActiveRecord::Migration
    def change
      create_table :daily_quotes do |t|
        t.date :date
        t.decimal :bid
        t.decimal :offer
        t.decimal :price
        t.integer :volume
        t.integer :stock_id
  
    t.timestamps
      end
    end
  end
  </code></pre>
  
  <p>I have already created a Stocks table with the StockName and ID as columns.</p>