18 Jul 17:25
FasterCSV: Two quick, simple, painless questions...
From: Joe Peck <rails-mailing-list@...>
Subject: FasterCSV: Two quick, simple, painless questions...
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-07-18 15:29:07 GMT
Subject: FasterCSV: Two quick, simple, painless questions...
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-07-18 15:29:07 GMT
Hi, how is everybody doing? 1) How do I make sure that the file that is being uploaded is a CSV file, and not another kind of file? 2) Sometimes, when I'm parsing through the CSV file, it tries to read the row after the last row, and just reads in a bunch of nils. When I look at the row in Excel, it is completely blank, yet FasterCSV still tries to read it in. How can I stop this? Any suggestions are appreciated. Joe -- -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> 1) How do I make sure that the file that is being uploaded is a CSV
> file, and not another kind of file?
Since CSV files are plain text files, I'm not sure what kind of
verification you can do, short of trying to read it to see if it is a
CSV file that you expect.
> 2) Sometimes, when I'm parsing through the CSV file, it tries to read
> the row after the last row, and just reads in a bunch of nils. When I
> look at the row in Excel, it is completely blank, yet FasterCSV still
> tries to read it in. How can I stop this?
>
> Any suggestions are appreciated.
Have you tried to look at the file in another viewer like Notepad to
see the raw text? I suspect you have a trailing row of just commas at
the end.
Jeff
softiesonrails.com
purpleworkshops.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
RSS Feed