By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,654 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,654 IT Pros & Developers. It's quick & easy.

Reading Excel to MySql or Comma delimited ...

P: n/a
Can anyone point me in the right direction on how to deal with an xls
flie.

Sorry to be basic in my request, but the only other file I have to work
with is pdf.

I'm not sure, is xls the better of two evils?

Nick

Jun 14 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi, I'm back,

I want to read the BT hotspots xls to a readable format...

http://www.btopenzone.com/downloads/...tspot_List.xls

Thanks
Jun 14 '06 #2

P: n/a
elyob wrote:
I want to read the BT hotspots xls to a readable format...
http://www.btopenzone.com/downloads/...tspot_List.xls


Use PHP's curl[1] stuff to download and save the file, use system()[2] to
pass it through xls2csv[3], read the result into a PHP array using
file()[4] and then explode()[5] each element of the array on comma.

____
1. http://uk2.php.net/manual/en/ref.curl.php
2. http://uk2.php.net/manual/en/function.system.php
3. http://www.45.free.net/~vitus/software/catdoc/
4. http://uk2.php.net/manual/en/function.file.php
5. http://uk2.php.net/manual/en/function.explode.php

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jun 15 '06 #3

P: n/a
Save your excel file into csv format.

Then use mysql command to automattically insert from file.

Otherwise use php function fgetcsv() to read the csv file.

--
http://blog.deshot.com
http://www.deshot.com

ne*********@gmail.com wrote:
Can anyone point me in the right direction on how to deal with an xls
flie.

Sorry to be basic in my request, but the only other file I have to work
with is pdf.

I'm not sure, is xls the better of two evils?

Nick


Jun 15 '06 #4

P: n/a

"Toby Inkster" <us**********@tobyinkster.co.uk> wrote in message
news:us************@ophelia.g5n.co.uk...
elyob wrote:
I want to read the BT hotspots xls to a readable format...
http://www.btopenzone.com/downloads/...tspot_List.xls


Use PHP's curl[1] stuff to download and save the file, use system()[2] to
pass it through xls2csv[3], read the result into a PHP array using
file()[4] and then explode()[5] each element of the array on comma.

____
1. http://uk2.php.net/manual/en/ref.curl.php
2. http://uk2.php.net/manual/en/function.system.php
3. http://www.45.free.net/~vitus/software/catdoc/
4. http://uk2.php.net/manual/en/function.file.php
5. http://uk2.php.net/manual/en/function.explode.php


Thanks all for the replies. I've been busy just testing the work, and
manually converting to csv to start with and uploading the file via
phpmyadmin.

However, am getting an error ... Invalid field count in CSV input on line
748

I'm looking at the file, and cannot see any problems with this middle line
....

Oulu airport,Airport,Oulu airport,,Oulunsalo,90460,Finland,Sonera Homerun
Hotel Rantasipi Eden,Hotel,Paratiisikatu
2,,Paratiisikatu,37120,Finland,Sonera Homerun
Stadshotellet Jakobstad,Hotel,Kanalesplanaden
13,,Pietarsaari,68600,Finland,Sonera Homerun

I've just removed that single line, and the file now uploads fine. However,
it's eight fields etc, and all looks fine.

<scratches head>
Jun 16 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.