2015/09/18

PHPExcel 用法


<?php
 //include PHPExcel
 require_once 'PHPExcel.php';

 //讀取2007的Excel file
 $reader = new PHPExcel_Reader_Excel2007();
        //載入檔案
 $excel = $reader->load('test.xlsx');
 
 //指定Sheet,從0開始
 $excel->setActiveSheetIndex(編號);

 //取得指定Cell值
 $excel->setActiveSheetIndex(0)->getCell('A1')->getValue();
 
 //取得Sheet Title
  $excel->setActiveSheetIndex($index)->getTitle();

?>