If you can save the table in CSV format, it is much better for processing CSV files than for parsing Excel tables. I found an effective way to deal with such a problem - to do a rake task that reads a CSV file and creates all the records as needed.
So, for example, here's how to read all the lines from a file using the old, but still effective FasterCSV gem
data = FasterCSV.read('lib/tasks/data.csv')
columns = data.remove(0)
unique_column_index = -1
data.each do | row |
r = Record.find_or_initialize_by_unique_column(row[unique_column_index])
columns.each_with_index do | index, column_name |
r[column_name] = row[index]
end
r.save! rescue => e Rails.logger.error("Failed to save #{r.inspect}")
end
It really relies on you to have a unique column in the original spreadsheet to get away.
, , Capistrano script, . find_or_initialize , .