PHP and EXCEL docs
Moderator: General Moderators
PHP and EXCEL docs
Is there anyway i can read data from an excel document in a php script, like from a database???
Please help me!!!
Sincerly,
Codrin
Please help me!!!
Sincerly,
Codrin
Saving the excel doc as a fixed formatted or csv file makes it much easier to work with. Then you can just open the file and read in one line at a time. Then take each line and explode the different columns into an array.
Code: Select all
<?php
//Open the file
$fp = fopen("exceldoc.csv","r");
//Try to read in the first line of the file
$line = fgets($fp,9000);
//Keep reading until the end of the file
while (!feof($fp))
{
//Split the colums in to an array
$info_array = explode(",",$line);
$col1 = $info_arrayї0];
$col2 = $info_arrayї1];
$col3 = $info_arrayї2];
$col4 = $info_arrayї3];
//Do something with the information
//Try to read in the next line
$line = fgets($fp,9000);
}
?>Hey,
Well, if you could parse excels format, then you're in luck, but i'm sure that has to be a very difficult thing to do. There is a project on sourceforge to create excel docs using php, but I'm not sure of the extent of it. I would suggest check with them to see how far they've come or if they can help you.
Another thing: Google is your freind. Try searching there.
One more thing. Does it have to be in an .xls format? I remeber from my much hated MicroRiech days that you could dump excel files into delimited text files. Wouldn't this be easier to deal with?
Cheers,
BDKR
Well, if you could parse excels format, then you're in luck, but i'm sure that has to be a very difficult thing to do. There is a project on sourceforge to create excel docs using php, but I'm not sure of the extent of it. I would suggest check with them to see how far they've come or if they can help you.
Another thing: Google is your freind. Try searching there.
One more thing. Does it have to be in an .xls format? I remeber from my much hated MicroRiech days that you could dump excel files into delimited text files. Wouldn't this be easier to deal with?
Cheers,
BDKR
See Share Office http://www.badblue.com/helpphpo.htm
php & excel author
Thanks for the replys, I'm a beginner in PHP and programming, can you be more specific.
how can I use COM with PHP exactly?
how can I use COM with PHP exactly?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
There's this too:
http://www.devshed.com/Server_Side/PHP/ ... page1.html
and this
Using MySQL and PHP to Present Excel Spreadsheets
Mac
http://www.devshed.com/Server_Side/PHP/ ... page1.html
and this
Using MySQL and PHP to Present Excel Spreadsheets
Mac