4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CodeIgniter + PHPExcel 備忘録

Posted at

CodeIgniter + PHPExcel 備忘録

PHPExcelとPHPExcel.php は /application/libraries/配下に配置。

/application/libraries/PHPExcel
/application/libraries/PHPExcel.php

あとはこんな感じで利用できる。

require_once 'application/libraries/PHPExcel.php';
require_once 'application/libraries/PHPExcel/IOFactory.php';

$objPHPExcel = new PHPExcel();
$objPHPExcel = PHPExcel_IOFactory::load($file);

$data = array();
$cells = $objPHPExcel->getActiveSheet()->getCellCollection();
foreach ($cells as $cell) {
    $col = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn();
    $row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow();
    $val = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue();
    $data[$row][$col] = $val;
}
4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?