I want to compare the 1st column of two excel files and if a match is found, I need to copy value of the 5th column to another excel sheet. I've tried php_excel_reader
and php_excel_writer
but with no success.
I want something like this:
excelF1;
excelF2;
for ($i=1; $i<=rowlength(excelF1); $i++)
{
val1 = excelF1[i][1];
for ($j=1; $j<=rowlength(excelF2); $j++)
{
val2 = excelF2[j][1];
if(val1 == val2)
{
val3 = excelF2[j][5];
//insert val3 into last column of excelF1;
}
}
}
try fgetcsv() and fputcsv() function.
Try this: PHPExcel and the PHPExcel Examples or more lightweight php-excel-reader (for xls only)