Voting

: max(three, one)?
(Example: nine)

The Note You're Voting On

don at digithink dot com
18 years ago
<?php
// The above import function can be easily extended using
// /usr/local/bin/xls2csv (part of catdoc ) and popen
// to read excell files directly.
// In our particular application the first line was the file heading.
function importxls($file,$head=true,$throwfirst=true,$delim=",",$len=1000) {
$return = false;
$handle = popen("/usr/local/bin/xls2csv $file", "r");
// or die if not there.
if ($throwfirst) {
$throw = fgetcsv($handle, $len, $delim);
}
if (
$head) {
$header = fgetcsv($handle, $len, $delim);
}
while ((
$data = fgetcsv($handle, $len, $delim)) !== FALSE) {
if (
$head AND isset($header)) {
foreach (
$header as $key=>$heading) {
$row[$heading]=(isset($data[$key])) ? $data[$key] : '';
print
"<li>". $heading ."=>" . $row[$heading]."</li>";
}
$return[]=$row;
} else {
$return[]=$data;
}
}
fclose($handle);
return
$return;
}
?>

<< Back to user notes page

To Top