473,323 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Reading Excel to MySql or Comma delimited ...

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
4 1940
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
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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ron McCafferty | last post by:
How do you read comma delimited data from programs such as Excel where the data itself contains dounble quotes and commas. It used to be you could just use input. How is it fone now? The data...
0
by: dd | last post by:
I am kind of puzzled with this problem. I am trying to open an xls file from C# and then save it as text or comma delimited. Here is the code: Excel.ApplicationClass oExcelApp = new...
1
by: Flack | last post by:
Hello, When the user of my app selects some rows from an open excel file and drag-n-drops them onto my form, I need to be able to parse those lines and create a datatable that would match the...
4
by: washoetech | last post by:
Hello, I am working on a project where I need to be able to grab the data from an Excel spreadsheet and create a new table in my database based on the columns in the spreadsheet. After the...
3
by: herman404 | last post by:
Hi everyone, I have data coming to me in the form of Word and Excel files, and I need to place this data into a SQL Server database. The Word file will be coming in text which is similiar to an...
2
by: Jacob.Bruxer | last post by:
Hi everyone, I'm having trouble opening space delimited textfiles in Excel from Visual Basic.net. I'm able to control, open and modify Excel files from Visual Basic, so my Excel reference seems...
1
by: Quentin | last post by:
I want to take a comma delimited text file and export it to excel format, using the comma as the delimiter. Any help on this would be great, thank you.
0
by: Hoop | last post by:
Hi, I have a VB app that I am trying to open a text file where the data is comma seperated. I would like to save that file so that the user can open it in Excel rows and columns. I have code...
15
by: pakerly | last post by:
How would i do this, convert a test file to excel? Lets say my text file has fields like this: NUMBER NAME ADDRESS PHONE 11002 Test1 ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.