473,396 Members | 1,852 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,396 software developers and data experts.

Parsing Excel spreadsheet to db

What would one best recommend to parse an existing Excel spreadsheet (was
done in Excel 97 or 2000 not sure to be honest)? I am looking for the most
practical way of parsing an existing spreadsheet to place contents into a
mySQL db.

Thanx, Phil

PS: can you use fopen() to read the contents and parse? The spreadsheet is
on a remote site.
Jul 16 '05 #1
6 8525

"Phil Powell" <so*****@erols.com> wrote in message
news:aws7b.145605$xf.35957@lakeread04...
What would one best recommend to parse an existing Excel spreadsheet (was
done in Excel 97 or 2000 not sure to be honest)? I am looking for the most practical way of parsing an existing spreadsheet to place contents into a
mySQL db.

Thanx, Phil

PS: can you use fopen() to read the contents and parse? The spreadsheet is
on a remote site.


i don't know how big your spreadsheet is, but you could save the excel
spreadsheet as a "csv" type file, then use fopencsv() to read it, then use
explode() to create columns out of each row (thus giving you a
multi-dimensional array breaking values down to an excel cell)... You could
then use this array as your source data and send it to mysql.
Jul 16 '05 #2
I would, but I have neither Microsoft Excel nor do I have the spreadsheet
locally (were I to do so since not having Excel it would not be able to do
anything with it.)

Since I can't convert it to .csv because of that, what do I do?

Thanx
Phil

"Randell D." <yo**************************@yahoo.com> wrote in message
news:g7***********************@news3.calgary.shaw. ca...

"Phil Powell" <so*****@erols.com> wrote in message
news:aws7b.145605$xf.35957@lakeread04...
What would one best recommend to parse an existing Excel spreadsheet (was done in Excel 97 or 2000 not sure to be honest)? I am looking for the most
practical way of parsing an existing spreadsheet to place contents into a mySQL db.

Thanx, Phil

PS: can you use fopen() to read the contents and parse? The spreadsheet is on a remote site.


i don't know how big your spreadsheet is, but you could save the excel
spreadsheet as a "csv" type file, then use fopencsv() to read it, then use
explode() to create columns out of each row (thus giving you a
multi-dimensional array breaking values down to an excel cell)... You

could then use this array as your source data and send it to mysql.

Jul 16 '05 #3

"Phil Powell" <so*****@erols.com> wrote in message
news:NIv7b.146397$xf.117696@lakeread04...
I would, but I have neither Microsoft Excel nor do I have the spreadsheet
locally (were I to do so since not having Excel it would not be able to do
anything with it.)

Since I can't convert it to .csv because of that, what do I do?

Thanx
Phil

"Randell D." <yo**************************@yahoo.com> wrote in message
news:g7***********************@news3.calgary.shaw. ca...

"Phil Powell" <so*****@erols.com> wrote in message
news:aws7b.145605$xf.35957@lakeread04...
What would one best recommend to parse an existing Excel spreadsheet (was done in Excel 97 or 2000 not sure to be honest)? I am looking for the most
practical way of parsing an existing spreadsheet to place contents
into a mySQL db.

Thanx, Phil

PS: can you use fopen() to read the contents and parse? The
spreadsheet
is on a remote site.


i don't know how big your spreadsheet is, but you could save the excel
spreadsheet as a "csv" type file, then use fopencsv() to read it, then use explode() to create columns out of each row (thus giving you a
multi-dimensional array breaking values down to an excel cell)... You

could
then use this array as your source data and send it to mysql.


If you don't have the Excel file locally, how do you expect PHP to process
it? If you can get it via a hyperlink, then I make the assumption then that
you have an "xls" type file - I don't believe there's an existing function
that would open it for you.

Is it a one off task? If so, and you don't know someone who has Excel to
convert it for you, then try OpenOffice.org (free and works on all versions
of office documents up to Office 2000). Then re-save it as a "csv" type
file.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
Jul 16 '05 #4
See Below

"Randell D." <yo**************************@yahoo.com> wrote in message
news:8p***********************@news3.calgary.shaw. ca...

"Phil Powell" <so*****@erols.com> wrote in message
news:NIv7b.146397$xf.117696@lakeread04...
I would, but I have neither Microsoft Excel nor do I have the spreadsheet
locally (were I to do so since not having Excel it would not be able to do anything with it.)

Since I can't convert it to .csv because of that, what do I do?

Thanx
Phil

"Randell D." <yo**************************@yahoo.com> wrote in message
news:g7***********************@news3.calgary.shaw. ca...

"Phil Powell" <so*****@erols.com> wrote in message
news:aws7b.145605$xf.35957@lakeread04...
> What would one best recommend to parse an existing Excel spreadsheet (was
> done in Excel 97 or 2000 not sure to be honest)? I am looking for the most
> practical way of parsing an existing spreadsheet to place contents

into
a
> mySQL db.
>
> Thanx, Phil
>
> PS: can you use fopen() to read the contents and parse? The

spreadsheet
is
> on a remote site.
>
>

i don't know how big your spreadsheet is, but you could save the excel
spreadsheet as a "csv" type file, then use fopencsv() to read it, then

use explode() to create columns out of each row (thus giving you a
multi-dimensional array breaking values down to an excel cell)... You

could
then use this array as your source data and send it to mysql.


If you don't have the Excel file locally, how do you expect PHP to process
it? If you can get it via a hyperlink, then I make the assumption then

that you have an "xls" type file - I don't believe there's an existing function
that would open it for you.

Is it a one off task? If so, and you don't know someone who has Excel to
convert it for you, then try OpenOffice.org (free and works on all versions of office documents up to Office 2000). Then re-save it as a "csv" type
file.
--
I can't install OpenOffice! the setup.exe file does absolutely nothing. I
went to www.openoffice.org and downloaded the entire package for Windows
2000, and nothing happens. So I'm back to the drawing board!

Phil
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

Jul 16 '05 #5
Phil Powell wrote on Tuesday 09 September 2003 23:34:
I can't install OpenOffice! the setup.exe file does absolutely nothing. I
went to www.openoffice.org and downloaded the entire package for Windows
2000, and nothing happens. So I'm back to the drawing board!


There is one other way. If you have or have access to Excel ODBC drivers,
you could set up an ODBC data source pointing to the specified Excel file
with defined tables inside the spreadsheet. Then you could use the ODBC
connection from PHP to access data from Excel spreadsheet like you would to
other databases.

One thing to keep in mind is that - Excel file has a proprietary format. If
you do not have MS Office with Excel, you don't have COM components that
access Excel spreadsheets, you don't have Excel ODBC drivers, and you
cannot install any other applications that would export Excel spreadsheet
to a non-proprietary format (like text CSV or tab-separated file), then you
are running out of ways of accessing data stored in that file format.
--
Business Web Solutions
ActiveLink, LLC
www.active-link.com/intranet/
Jul 16 '05 #6
See below - thanx
Phil

"Zurab Davitiani" <ag*@mindless.com> wrote in message
news:%9*****************@newssvr25.news.prodigy.co m...
Phil Powell wrote on Tuesday 09 September 2003 23:34:
I can't install OpenOffice! the setup.exe file does absolutely nothing. I went to www.openoffice.org and downloaded the entire package for Windows
2000, and nothing happens. So I'm back to the drawing board!

There is one other way. If you have or have access to Excel ODBC drivers,
you could set up an ODBC data source pointing to the specified Excel file
with defined tables inside the spreadsheet. Then you could use the ODBC
connection from PHP to access data from Excel spreadsheet like you would

to other databases.

One thing to keep in mind is that - Excel file has a proprietary format. If you do not have MS Office with Excel, you don't have COM components that
access Excel spreadsheets, you don't have Excel ODBC drivers, and you
cannot install any other applications that would export Excel spreadsheet
to a non-proprietary format (like text CSV or tab-separated file), then you are running out of ways of accessing data stored in that file format.


Exactly. I don't have Office so I wouldn't have the Excel ODBC drivers. I
wound up sending the file to a colleague who converted it for me into CSV.
Hopefully a one-time solution, other than that, I am powerless to do
anything else.

Phil

--
Business Web Solutions
ActiveLink, LLC
www.active-link.com/intranet/

Jul 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Hugh McLaughlin | last post by:
Hello Everyone and thanks for your help in advance. I am working on an application that requires the parsing of an Excel spreadsheet that will be loaded into a SQL Server table. An example of...
0
by: Jeff | last post by:
I will start off by giving you a background of the process I am taking. The nature of my DTS package is that I recieve an Excel Spreadsheet, run it through the DTS Package applying validation to...
9
by: (Pete Cresswell) | last post by:
I see this coming on a develpment effort that may materialize shortly. These guys don't want to mess around with automated imports from text feeds BC in the past they've had too many problems...
0
by: Rich Wallace | last post by:
Hello all, Looking for suggestions and tips if possible. I have an application running on a file server that utilizes the FileSystemWatcher to trap when any Excel files are saved by a user. I...
1
by: garry.oxnard | last post by:
Can anyone help me to solve a problem which involves switching from Access to Excel (then back to Access) programatically please? I have an Excel template which, on open, also opens an Access...
0
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may...
1
by: Sport Girl | last post by:
Hi everybody , i have the task of developing in Perl a script that retrieves data from 3 tables ( bugs, profiles, products) from a MySQL database called bugs and display them in an excel sheet...
3
by: S_K | last post by:
Hi, I have a problem when I try to save a .CSV file from an ASP.NET web page and the client has Excel open already. The symptoms are: 1) The web page is currently displaying the Excel...
2
by: treybraid | last post by:
My Flash file is a GameCenter where team standings are kept.. I have it set up right now with the master spreadsheet programmed that is linked to a dummy sheet that is saved as a CVS doc and loaded...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.