importing csv files..

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

importing csv files..

sergio_101-2
i am currently working on importing several csv, all of which refer to
each other via an id.. this doesn't seem too nasty.. but the question
i have is..

is there a CSV import package that will just import the csv into a set
of arrays that i can just loop through?

thanks!


--

----
peace,
sergio
photographer, journalist, visionary

http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: importing csv files..

David T. Lewis
On Thu, Feb 25, 2010 at 09:45:28AM -0500, sergio_101 wrote:
> i am currently working on importing several csv, all of which refer to
> each other via an id.. this doesn't seem too nasty.. but the question
> i have is..
>
> is there a CSV import package that will just import the csv into a set
> of arrays that i can just loop through?

Try looking at http://www.squeaksource.com/ and search for package named
"CSV Parser".

You can load it into Squeak using Monticello with the following address:

MCHttpRepository
    location: 'http://www.squeaksource.com/CSV'
    user: ''
    password: ''

The files are at: http://www.squeaksource.com/CSV/

Ask more questions if the above does not make sense.

Dave
 
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: importing csv files..

sergio_101-2
>
> The files are at: http://www.squeaksource.com/CSV/
>
> Ask more questions if the above does not make sense.
>

found it...

quick question..

do these packages come with documentation or examples?

thanks!


--

----
peace,
sergio
photographer, journalist, visionary

http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: importing csv files..

David T. Lewis
On Thu, Feb 25, 2010 at 09:08:02PM -0500, sergio_101 wrote:

> >
> > The files are at: http://www.squeaksource.com/CSV/
> >
> > Ask more questions if the above does not make sense.
> >
>
> found it...
>
> quick question..
>
> do these packages come with documentation or examples?

Actually, I do not know, so the best thing is to load the package
and look at the code.

The author, Avi Bryant, is a very highly regarded developer. I expect
the code to be high quality but not necessarily well documented.

Parsing CSV files is quite simple in most cases, so many people probably
just write their own parser as needed (I know that I have done this in
the past). However, handling the quote characters and other special
cases can be tricky, and I expect that Avi has given this some thought.

HTH,
Dave
 
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: importing csv files..

sergio_101-2
> Parsing CSV files is quite simple in most cases, so many people probably
> just write their own parser as needed (I know that I have done this in

gotcha.. thanks!

this does lead to one more question..

where does the documentation for packages usually live?

thanks!


--

----
peace,
sergio
photographer, journalist, visionary

http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re[2]: [Newbies] importing csv files..

Herbert König
Hi sergio;


s> where does the documentation for packages usually live?

class comments and less often method comments. Sometimes you find a
method category "Examples" on the class side.

This all is not so in this example. I've looked at it (I wrote
something for tab delimited files myself) and I guess it goes like:

fileStream := StandardFileStream readOnlyFileNamed:  'thePath\theFileToRead' asFileName.
"Use FileStream if you suspect UTF8, it's slower"
fileStream ascii.
arrayFullOfRows := CSVParser parse: fileStream.

All guessed from my code and the code I looked at, so take it with a
grain of salt.

In general, look at class side methods and follow the source of
instance creation methods.



Cheers,

Herbert  

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: [Newbies] importing csv files..

sergio_101-2
> In general, look at class side methods and follow the source of
> instance creation methods.
>

thanks so much!


--

----
peace,
sergio
photographer, journalist, visionary

http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners