EXCEL: selection d'une feuille avec PHP

Fermé
billypote Messages postés 44 Date d'inscription lundi 21 juillet 2008 Statut Membre Dernière intervention 7 août 2015 - 5 nov. 2008 à 10:36
billypote Messages postés 44 Date d'inscription lundi 21 juillet 2008 Statut Membre Dernière intervention 7 août 2015 - 5 nov. 2008 à 16:00
Bonjour,

En PHP j'arrive à ouvrir un fichier Excel existant, et à écrire dedans, sauf que pour écrire dedans je créé forcément une nouvelle feuille qui écrase les feuilles existantes:
require_once "excelWriter/class.writeexcel_workbook.inc.php";
require_once "excelWriter/class.writeexcel_worksheet.inc.php";
require_once "excelReader/reader.php";

$var= 'tut.xls';

	
	
	$workbook =& new writeexcel_workbook(fopen($var,"r+")) or die ("Error");
	$worksheet =& $workbook->addworksheet('Tut 1') or die ("Error 2");
	
	
	
	
	
	
	//$book=$excel->Workbooks(1) ;
	//$sheet=$book->Worksheets(1) ;
	# The general syntax is write($row, $column, $token). Note that row and
	# column are zero indexed
	#
	//*
	# Write some text
	$worksheet->write(2 ,0,  "Meuhhh !");
	$worksheet->write(2 ,1,  "Pouet");
	$worksheet->write(2 ,2,  "Plop");

	$workbook->close();
	

	header("Content-Type: application/x-msexcel; name=\"example-simple.xls\"");
	header("Content-Disposition: inline; filename=\"example-simple.xls\"");
	$fh=fopen($fname, "rb");
	fpassthru($fh);
	unlink($fname);


Je voudrais savoir comment sélectionner une feuille déja existante, un équivalent de sheets("feuille X").select en VBA en gros.

Merci d'avance pour toute aide éventuelle.
A voir également:

1 réponse

billypote Messages postés 44 Date d'inscription lundi 21 juillet 2008 Statut Membre Dernière intervention 7 août 2015 10
5 nov. 2008 à 16:00
up ! :)
0