Advertisement
krot

xls convert csv

Mar 23rd, 2016
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. set_time_limit(0);
  2. ini_set('memory_limit', -1);
  3.  
  4. include 'PHPExcel/IOFactory.php';
  5.  
  6. convertXLStoCSV('kamaz.xls','output.csv');
  7.  
  8. function convertXLStoCSV($infile,$outfile)
  9. {
  10.     $fileType = PHPExcel_IOFactory::identify($infile);
  11.     $objReader = PHPExcel_IOFactory::createReader($fileType);
  12.  
  13.     $objReader->setReadDataOnly(true);  
  14.     $objPHPExcel = $objReader->load($infile);    
  15.  
  16.     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
  17.     $objWriter->save($outfile);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement