Ruby on Rails Monday, September 3, 2012



On Sunday, September 2, 2012 9:16:41 PM UTC+1, Ruby-Forum.com User wrote:

Hello,

I am trying to use Spreadsheet gem to import some data in the db. I open
a xls as

member_file=Spreadsheet.open("#{RAILS_ROOT}/public/data/FAMILY-MEMBER.xls")

but after that when I try to open the file using Excel I get an error
that file is locked by another user for editing. Only way to release the
lock is to kill the rails server. And there is no method to close the
file in the gem. How do I solve this problem? 'Roo' also had the same
issue. Is there any gem which I can use to import/export the data from
excel which does not have these issues?

Have you tried using the block form?

Spreadsheet.open(path) do |workbook|
  ...
end

Fred 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/SPgCZBZj2qYJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment