使用php进行Excel验证

I have an excel sheet that is loaded with a dynamic result set of data.I need to validate the excel sheet before insert into mysql table.Validation such as Is there any duplicate entry,email validation etc.Any idea about how can validate using php.

How do you parse the xls itself? For me the most simple solution is to parse the whole xls into an array then validate that. You can easily check for duplicates then iterate through with one foreach and validate the remaining.

As easy as :

You can use COM functions under PHP

$excel = new COM("excel.application") or die("Unable to instanciate excel");

//Open your file
$excel->Workbooks->Open("files/test.xls");

$Workbook = $excel->Worksheets(1); //Select the wortksheet
foreach($Workbook = $excel->Worksheets as $Worksheet)
{
   //Loop each page in the book
   $Worksheet->Activate; //Activate Sheet 1

   for($row=0;$row<=$Worksheet->rows;$row++)
   {
       $row_item = $Worksheet->rows[$row];
       //Hmm, i forgot the rest but you can do that ;)
   }
}

You will have to read more about it, as i have never used it to open Excel sheets.

http://www.php.net/manual/en/class.com.php