parseCSV 0.2.0

January 1st, 2007

I have to get some real work done, that i can post about, cause this is starting to feel like i’m a broken record player just, cause all i’ve posted about lately is parseCSV{}… lol

Obviously having major hard drive problems haven’t helped :P

Anyway, i spent the most part of today updating parseCSV{}, finishing an automatic delimiter character detection, cause the original project i created it for, requires such a function. The reason being so users don’t really have to know what a delimiter character is, or which one the file their attempting to upload uses. Eitherway, its a very handy function, and hardly slows down the script at all.

The original reason i started working on it cause i realized some versions of MS Excel for Windows uses ; instead of , as a delimiter no matter which CSV option you choose. And the script was being used to upload that from Excel, which caused issues, so to simplify matters, some type of auto-detection was required…

The auto() function works by simply analyzing a specific number of rows (15 by default) from the beginning of the csv file/data, and eliminating characters that simply can’t be the delimiter cause it doesn’t exist on every row, or the the number of times a character appears in a row isn’t the same on all rows. Rarely will any other character than the actual delimiter get past this stage of elimination, but if more then one character does, the script goes on to further analyze details to choose which character is the most likely to be the delimiter.

6 Responses to “parseCSV 0.2.0”

  1. Ben Says:

    IS this class available for use by others. When I click on the link http://zhuoqe.org/svn/codeyard/trunk/php/classes/parseCSV/ it prompt for a login?

  2. jim Says:

    hey ben,
    i’m sorry for the inconvenience, it seems a recent update to the server caused the public svn repo’s to require authentication, i’ve taken care of the issue and it seems to be working fine again :)

  3. Pierre Says:

    Hi,

    What append when there is no header? I would like that default harder look like: H1, H2, H3, etc…

    Pierre

  4. jim Says:

    are you parsing or generating CSV data? also, headers/fields can be set manually using the $object->fields variable…

    also, if you’re appending data to an existing CSV file, you have to know the exact structure of the file already or you’ll end up with a somewhat screwed CSV file… lol

    i honestly don’t know exactly what you mean tho, i’ll try to help if you can explain with a bit more details :)

  5. muneefvc Says:

    wow!
    this thing really helps!
    thanx

  6. arena Says:

    Hi,

    Trying to use your class with a csv file coming from gmail (exporting my gmail contacts).
    The result is awfull.

    Please help!

Leave a Reply