<?
class Export_Excel {
var $command
function Export_Excel() {
$this->command = "/xls2csv";
}
function xls2csv($path,$xls_file,$short_name) {
$cmd = escapeshellcmd("$this->command -q 0 $path.$xls_file");
$cmd .= " > $path.$short_name.csv";
@exec($cmd,$stdout,$errocode);
unlink("$path.$xls_file");
if ($errorcode > 0) return $errocode;
}
}
then in my db class
function insert_file($filename,$table,$col_terminator,$line_terminator,$cols=false,$opt
ions=false,$remove_file=false) {
if ($options) $option = "OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY
'\n'";
$this->query("LOAD DATA INFILE '$filename' INTO TABLE $table FIELDS
TERMINATED BY '$col_terminator' $option $cols");
if ($remove_files) unlink($filename);
}
?>
the xls2csv binary can be found @ http://www.45.free.net/~vitus/ice/catdoc/ver-0.9.html
Excel class in PHP Categories : PHP , PHP Classes , Excel Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP , PHP , HTML , PDF , Excel Array Insertion Categories : PHP , PHP Classes , Arrays crop and resize image class using gd library function Categories : PHP , PHP Classes , GD image library , Graphics Simple and fast user authentication Categories : PHP , PHP Classes , Authentication file class , uploade file , download file already uploaded on another website Categories : PHP , PHP Classes , Filesystem , Web Services POP3 Class Categories : PHP Classes , PHP , Email MySQL Connection/Query Class Categories : Databases , MySQL , PHP , PHP Classes Simple class for accessing databases like MSSql Server, Oracle etc by Raju Categories : PHP , MS SQL Server , Databases , PHP Classes , Oracle Render TTF Text to PNG. Text message, font, size, rotation, padding, color, background, and transparency can all be defined via URL. Categories : PHP , PHP Classes , Graphics Credit Card Identification and Validation Class - The credit_card class provides methods for cleaning, validating and identifying the type of credit card numbers. Categories : PHP , PHP Classes , Credit Cards , Ecommerce , Algorithms phpFormGenerator for Dynamic Form Generation from MySQL Categories : PHP , PHP Classes , MySQL , Databases , HTML and PHP simple shopping cart for php3 Categories : PHP , PHP Classes , Complete Programs , Ecommerce cPanel Email Accounts Creator Categories : PHP , PHP Classes , Email , Form Processing , Web Services HTTP gzip compression Categories : PHP , PHP Classes , Compression , Zlib