MadsRH
MadsRH

Reputation: 13

Extracting a specific cell with SimpleXLSX to PHP

Hi This should be pretty simple but I can't figure it out. Can anyone tell me how I can extract one specific cell (like B4 in the spreedsheet)?

I can do something like this (from the included examples) to get all the cells, but I only want this exact one!

        echo '<tr>';
        for ( $i = 0; $i < $num_cols; $i ++ ) {
            echo '<td>' . ( ! empty( $r[ $i ] ) ? $r[ $i ] : '&nbsp;' ) . '

Upvotes: 0

Views: 596

Answers (2)

MadsRH
MadsRH

Reputation: 13

echo $xlsx->getCell(0, 'C1'); 

Upvotes: 0

Md.Shams Imran Shuvo
Md.Shams Imran Shuvo

Reputation: 96

Use PHPOffice/PhpSpreadsheet or any other package like this. You will get much functionality for working with excel.

$spreadSheet = new Spreadsheet();
$cellValue = $spreadSheet->getActiveSheet()->getCell('B4')->getValue();

Upvotes: 1

Related Questions