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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 18, 10:29 am, Joe Peck <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, how is everybody doing?Doing great! Thanks for asking. :-)> 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. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jul-19 15:45 UTC
Re: FasterCSV: Two quick, simple, painless questions...
Jeff, I''ve also used FasterCSV and just pray that some of the longer fields don''t have escape characters to blow the importation of records. I appealed with this question to several forums and haven''t been able to find a solution. Ultimately, it''d be nice to have something similar to the ex: <%=h @atx.description %> h verb the way it escapes html characters when passing the string inside the two delimiters of one field in a .csv record. I hope this makes sense?? Kathleen On Jul 18, 11:54 am, Jeff <cohen.j...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jul 18, 10:29 am, Joe Peck <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > Hi, how is everybody doing? > > Doing great! Thanks for asking. :-) > > > 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. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 19, 10:45 am, "KathysK...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <KathysK...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Jeff, > I''ve also used FasterCSV and just pray that some of the longer fields > don''t have escape characters to blow the importation of records. > I appealed with this question to several forums and haven''t been able > to find a solution. > Ultimately, it''d be nice to have something similar to the ex: <%=h > @atx.description %> h verb the way it escapes html characters when > passing the string inside the two delimiters of one field in a .csv > record. > I hope this makes sense?? > KathleenCan you give me an example of a CSV field with escape characters in it? I''m having a hard time imagining what might be causing the problem. Thanks, Jeff --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jul-24 13:26 UTC
Re: FasterCSV: Two quick, simple, painless questions...
Jeff, I was importing .csv records that had descriptions of inventory items. Some of these items were medical supplies that had the # sign (#15 Surgical blade) and some had the " sign (2-0 18" Vicryl Suture). I would be most grateful if you have any ideas on this. Kathleen On Jul 23, 11:09 pm, Jeff <cohen.j...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jul 19, 10:45 am, "KathysK...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <KathysK...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > Jeff, > > I''ve also used FasterCSV and just pray that some of the longer fields > > don''t have escape characters to blow the importation of records. > > I appealed with this question to several forums and haven''t been able > > to find a solution. > > Ultimately, it''d be nice to have something similar to the ex: <%=h > > @atx.description %> h verb the way it escapes html characters when > > passing the string inside the two delimiters of one field in a .csv > > record. > > I hope this makes sense?? > > Kathleen > > Can you give me an example of a CSV field with escape characters in > it? I''m having a hard time imagining what might be causing the > problem. > > Thanks, > Jeff--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---