Crear hojas de cálculo Excel con PHP
Existen varias formas de exportar a Excel mediante PHP. En este post vamos a servirnos de la clase Excel Writer.
La clase ExcelWriter es muy sencilla de utilizar y nos puede permitir realizar el proceso de exportación de una tabla de nuestra base de datos sin grandes complicaciones.
En el código que mostramos a continuación vemos un ejemplo ilustrativo de como se debe utilizar esta clase para escribir datos en un archivo .xls.
<?php
include("excelwriter.inc.php");
$excel=new ExcelWriter("FicheroExcel.xls");
$myArr=array("CeldaA1","CeldaB1","CeldaC1","CeldaD1");
$excel->writeLine($myArr);
?>
Lo primero que hacemos es incluir la clase que vamos a utilizar, crear una instancia pasándole el nombre del fichero y finalmente preparamos un array para escribirlo en la primera fila del documento excel.
Autor
Escrito por Jose Aguilar - Director ejecutivo y tecnológico en JA Modules. Experto programador PrestaShop y Experto programador WordPress.
yo he visto la aplicacion funcionando y me parece muy pero quisiera saber como se puede hacer para que en la misma hoja de calculo (excel) se puede agregar mas hojas de calculo (sheet), y pasar los datos sin necesidad de hacer otro archivo de excel
Hola,
Dejaremos la pregunta abierta para ver si alguien sabe la respuesta. A mi también me gustaría saberlo.
Saludos
Hola José Aguilar,
Muchas gracias por el aporte, pero ¿Dónde consigo la clase Excel Writer?
Veo que la incluyes en tu página PHP.
Te agradezco de antemano tu amable respuesta.
Hola,
Gracias por tu mensaje.
Hemos creado un archivo descargable para que puedas observar todos los ficheros del ejemplo en funcionamiento:
https://www.jose-aguilar.com/scripts/php/ExcelWriter/ExcelWriter.zip
Saludos
Hola, quisiera saber si hay alguna manera de exportar un excel con php, pero que el excel exportado tenga una imagen de agua.
Muchas gracias desde ya.
Hola, la verdad es que no lo se. Posiblemente con la librería PHPExcel lo puedas hacer.
COMO HAGO PARA Q AL CORRERLO EN OTRA MAQUINA Q NO SEA EL SERVIDOR, SE DESCARGUE EN ESA MAQUINA
Would love to perpetually get updated great blog!
It is appropriate time to make a few plans for the future and it is time to be happy. I’ve read this post and if I may just I want to suggest you some fascinating things or advice. Perhaps you could write subsequent articles relating to this article. I desire to learn even more issues approximately it!
You are my aspiration , I own few blogs and occasionally run out from to brand.
I like this site very much, Its a rattling nice place to read and receive information.
Excellent read, I just passed this onto a colleague who was doing some research on that. And he just bought me lunch because I found it for him smile So let me rephrase that: Thanks for lunch! «England and America are two countries separated by the same language.» by George Bernard Shaw.
I wish to show my love for your kindness in support of those people who have the need for assistance with this one idea. Your special commitment to passing the message all-around came to be wonderfully productive and has all the time made folks just like me to attain their ambitions. The warm and helpful help denotes a great deal to me and much more to my office colleagues. With thanks; from all of us.
Can you please forward me the code for this script or please inform me in detail concerning this script?
I do trust all of the ideas you’ve presented on your post. They’re very convincing and can certainly work. Nonetheless, the posts are very brief for novices. May just you please extend them a bit from next time? Thank you for the post.
Some really marvellous work on behalf of the owner of this internet site , utterly great content material .