[thelist] CSV & Excel

kristina ml at kfxdesign.net
Tue Feb 18 10:48:01 CST 2003


thelist,

  3 problems (apologies for length of post)

  Using PHP & MySQL (and lots of tutorial help off
  the net) I've managed to create a CSV file
  upload using PHP to a MySQL database.  When I
  edit CSV files I tend to edit via a text editor
  (HTML-Kit) and have no problems.

  My problem arises as soon as the data is handed
  over to the client.  They use Excel to
  edit the CSV file.  For the CSV file to work the
  first two fields are null as they are an id
  field and a timestamp field, and are
  automatically updated when the file is inserted.

  When I try and 'save as' from Excel it does two
  things - it removes the first two columns (my
  two null fields) and changes all the date
  formats to dd/mm/yy - when I need them to be
  yyyy-mm-dd.

  How do I insert a Null field into Excel and how
  do I make it keep the date format that I need.
  I tried to create the file first as *.xls then
  save as *.csv but when I upload it to the
  database - it uploads nothing.....!

  The other thing that I'm having trouble with is
  comma's within a CSV file. I've tried
  ,,"test data, test data",other data,
  but that just causes the bit after the comma,
  that isn't a seperator, to move into the next
  field, and ultimately doesn't work....  I've
  tried escaping the comma and I just get an
  error.

  The stuff I found on the net about escaping a
  comma, suggested doing this via Excel as that
  would add all the necessary bits to the CSV
  file.  I didn't have any joy there, partly for
  the above two problems (null fields and date
  fields)

  Any tutorial pointers would be grand.

  ;o)

--
bfn
.kristina

ml at kfxdesign.net
kfxdesign.net




More information about the thelist mailing list