<?php
// PHPExcelライブラリを読み込む
require_once 'PHPExcel.php';

// xlsxファイルを読み込む
$excel = PHPExcel_IOFactory::load('sample.xlsx');

// アクティブなシートを取得する
$sheet = $excel->getActiveSheet();

// 二次元配列を定義する
$array = array(
    array(1, 2, 3, 4, 5),
    array(6, 7, 8, 9, 10),
    array(11, 12, 13, 14, 15),
    array(16, 17, 18, 19, 20)
);

// B3からT列の最後までセルに入力する
$sheet->fromArray($array, null, 'B3', true);

// ファイルに保存する
$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
$writer->save('sample.xlsx');
?>