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
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()

}
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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()

}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.