Hey guys,

I have a 19 page word document that has couple of hundred listings. IE names, DOB, phone, city, state, etc..

The information is not formatted at all, basically the client just pressed "enter" and "space bar" to format it. No headings nothing.

Is there a way where I can just parse each line or easier way to dump this in mysql rather than copy and paste this document into excel one line at a time.

Thanks in advance.

    As you cannot trust the columns to be the same from line to line, I would not have a machine process it.

    I'd probably paste the whole thing in excell, to a text-to-column with space delimiter (doubles allowed). Edit the whole thing, and save as .csv. This you can quite easile import into mysql.

      Well does the information at least follow the same structure? If so, it's easy to ignore the formatting... as easy as doing:

      $columns = preg_split('/\s+/', $line);

      If they're arbitrarily leaving data out, then you'd have to delve into using pattern matching to figure out what "type" each column is, which can be very messy/impossible.

        Write a Reply...