Jump to content

Read Excel file and post the data.


jcm

Recommended Posts

First I need to read all the ".gif" in the folder and then take the name of that file and search that name and match it up from data in a column in Excel (that has product description, price, item number...etc).  How can this be done?

 

I am new to php.  But not new to the industry (9 years experience).

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/38635-read-excel-file-and-post-the-data/
Share on other sites

you can open a csv file like this:

 

<?
$file = "./database.csv";
$row = file($file); // get the rows
foreach($rows as $key => $row_content){ // loop through the rows

$cell = explode(',', $value); // break the row up into cells

// place code for matching data to a particular cell, such as eregi()

}
?>

I have had experience reading and writing to excel files. I highly recommend the use of the PEAR excel_writer class which is freely available from the PEAR website. Theres good documentation to it and its pretty easy to use.

 

Use the directory iterator to loop through your directory looking for gif files etc then use the http://pear.php.net/package/Spreadsheet_Excel_Writer class to look through the excel file.

Error:

Warning: Invalid argument supplied for foreach() in test.php on line 4.

 

What do I need to put down?

 

<?php
$file = "./Item Descriptions.csv";
$row = file($file); // get the rows
foreach($rows as $key => $row_content){ // loop through the rows

$cell = explode(',', $value); // break the row up into cells

// place code for matching data to a particular cell, such as eregi()

}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.