read('CurrentWines.xls'); // Excel file data is stored in $sheets property, an Array of worksheets /* The data is stored in 'cells' and the meta-data is stored in an array called 'cellsInfo' Example (firt_sheet - index 0, second_sheet - index 1, ...): $sheets[0] --> 'cells' --> row --> column --> Interpreted value --> 'cellsInfo' --> row --> column --> 'type' (Can be 'date', 'number', or 'unknown') --> 'raw' (The raw data that Excel stores for that data cell) */ // this function creates and returns a HTML table with excel rows and columns data // Parameter - array with excel worksheet data function sheetData($sheet,$wineType) { $re = ''; // starts html table $re .= ''; $x = 2; while($x <= $sheet['numRows']) { if (strtolower($sheet['cells'][$x][6]) == "$wineType" && strtolower($sheet['cells'][$x][8]) != 'fan') { $wine = $sheet['cells'][$x][1]; $vyds = $sheet['cells'][$x][2]; $price= $sheet['cells'][$x][3]; $wmn = $sheet['cells'][$x][4]; $fpn = $sheet['cells'][$x][5]; $re .= ''; $re .= ""; $re .= ''; $re .= ''; $re .= ""; $re .= ""; $re .= ''; $re .= ''; $re .= ""; $re .= ''; $re .= ''; $re .= ""; $re .= ''; } $x++; } return $re .'

$wine$price

$wmn

$fpn

'; // ends and returns the html table } $excel_data = ''; // to store the the html tables with data of each sheet // traverses the number of sheets and sets html table with each sheet data in $excel_data if (strtolower($_GET['wt']) =='fenestra-white-wines') { $imageName= "Fenestra White Wines"; $wineType='white'; } else { $imageName= "Fenestra Red Wines"; $wineType='red'; } $excel_data .= "$imageName". sheetData($excel->sheets[0],$wineType) .'
'; ?>