|
|
|
<?
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
|
|
| Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Excel class in PHP Categories : PHP, PHP Classes, Excel | | | file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | Authorize.net AIM Interface Class v1.0.0 Categories : PHP, PHP Classes, Ecommerce, Payment Gateways | | | crop and resize image class using gd library function Categories : PHP, PHP Classes, GD image library, Graphics | | | Expose - PHP template engine, supports server and client-sided caching,a plugin system, multiple languages, template script language is based on PHP itself. Categories : PHP, PHP Classes, Templates, Complete Programs | | | Simple Template Class/Example Categories : PHP, Templates, PHP Classes | | | News management class Categories : PHP, PHP Classes, Beginner Guides | | | The class to check load time of your script
VERY usefull for relatively slow applications, but not only.. Categories : PHP, PHP Classes, Debugging | | | ElfReader: An ELF (Executable and Linking Format) header information in PHP. Shows how to use the UNPACK function to read data. Categories : PHP, Linux, PHP Classes | | | RSS parser.
Parses RSS into an array. Quick and nasty but does the job.
No checking is done for correct Tags, only correct XML.
PHP4 needed to display result (uses print_r). Categories : PHP, XML, PHP Classes, Rich Site Summary (RSS) | | | MS Word Mail Merge Automation (COM) Categories : PHP, PHP Classes, COM | | | Very minimal templating engine Categories : PHP, PHP Classes, Templates | | | pcCalendar class - Allows for the creation of calendars in HTML pages. All output functions can be easily overridden, refer to article 1471 for an example.
Categories : PHP, Date Time, Calendar, PHP Classes | | | Class for sending mail with MIME attachments in multipart format using external sendmail, mimencode and zip Categories : Email, Network, PHP, PHP Classes | |
|
|
|