On one of our apps we did the same thing, pushing it first up to the
server and then doing the parsing there.  We actually used POI, which
is a Java based Excel compatible library (living in the Apache space,
just Google for it) and it works great for both Excel and for CSV.  As
Lothar states, it quickly get's complex so your success will depend on
how well you can constrain the data that is being imported.  I
wouldn't try to do it on the client as the only way to do it is to
have the user paste the CSV info into a text area and go from there.
Maybe that wouldn't be to bad...but you'd have to write all of the
parsing and junk that a number of server based libraries already have.

Later,

Shaffer

On Oct 17, 2:07 am, Lothar Kimmeringer <[EMAIL PROTECTED]> wrote:
> tin schrieb:
>
> > I need to have a CSV import functionality in my application. User can
> > give CSV files to the web client and then the server is supposed to
> > understand its contents and persist the data.
>
> > What would be the best approach to handle this?
>
> > - I upload the CSV file from the web client and use a library to parse
> > its contents on the server
> > - I parse the CSV on the web client itself and then pass the data to
> > the server (using RPC or JSON)
>
> > Any examples or pointers to best approaches to handle this problem
> > willl be highly appreciated.
>
> I would parse it on the server-side by using one of the CSV-parser-
> libraries around. That way you can support different charsets, the
> file might be encoded with (on Windows you most often see Cp1252,
> Cp850, UTF8 and UFT16, on Linux-systems dependent on their age
> ISO-8859-1 and UTF-8). If you want to develop a platform-independent
> application you would have to implement the conversion on the
> client-side which is unnecessary in my eyes.
>
> As well, CSV is not a standard per se, so there are different
> separators for values, some values might be escaped by quotation-
> marks or other characters. This topic is quite complex and re-
> inventing the wheel (as you would have to if you want to implement
> a GWT-compliant class) is a huge effort.
>
> Regards, Lothar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to