getNamedRange

Topics: Developer Forum
Feb 4, 2010 at 10:24 PM

Hi:

I have an Excel with some cells named like variables, and the formulaes of the sheet have references of these names instead of coordinates.

How can I set value of a cell based in his name instead of the coordinate ?

It has something to do with getNamedRange method, but I don't know how to use it properly.

Thank you in advance !

Developer
Feb 4, 2010 at 10:43 PM

If you have a cell named 'monkey', you can do like this:

$worksheet = $excel->getActiveSheet();
$worksheet->getCell('monkey')->setValue('hello');

 

Feb 5, 2010 at 6:36 AM

Cool, I didn't realice of that method.

Any way to do the same with the names of the spreedsheets instead calling them by index ?

THANK YOU

Coordinator
Feb 5, 2010 at 7:51 AM
Edited Feb 5, 2010 at 7:52 AM
dantart wrote:

Any way to do the same with the names of the spreedsheets instead calling them by index ?

$worksheet = $excel->getSheetByName('Sheet 3');
Feb 5, 2010 at 8:16 AM

Wow ... really i don't find those kind of things in the documentation :(

Coordinator
Feb 5, 2010 at 9:15 AM

Only the basics are detailed in the PHPExcel Developer Documentation MSWord document; but everything is covered in the API docs (though not necessarily to the same level of detail)

Feb 5, 2010 at 9:23 AM

I will check the API first  then ... :)

 

Thank you very much for the help !