使用for循环遍历excel区域


Loop through an excel range using a for loop

我正在使用PHPExcel创建一个*.xlsx文档,我正在尝试通过一个范围内的单元格负载进行循环。我可以分裂单元格,以获得第一个和最后一个在范围内,但它是可能的循环通过他们使用PHP for循环?谢谢。

$first_cell = 'A4';
$last_cell = 'M4';
for(...) :
endfor;

不如这样写:

foreach (range('A','M') as $letter) {
    $current=$letter.'4'
    // where $current is the cell you are doing stuff to in the loop iteration
}