PHP - import data into excel template

At first I am pretty new to php, like 3 weeks working with it, and I like it. This is a fantastic language. However, I ran into a problem, I have a client who wants to get the information collected in the form on this website, then to import into the Excel documents that he has already created. Since I'm fairly new, I’ve been searching for the past two hours and come up with so many different answers that my head is spinning.

I was wondering if anyone could instruct me if this can be done first and what is the best method.

Or, if you know a website that may already have explained it in a simple way, if you could direct me to this.

Thank you guys, hopefully someday I can be as smart as you :)

Peace

+3
source share
4 answers

First you need a library that can read your Excel template, such as PHPExcel , which you can then fill out the data from the form and save

+1
source

Hey Chris. It looks like you need to make a call to a COM object (Excel Automation) with PHP. I googled by calling COM objects from PHP and found a site that suggested doing something like this .. sample per word, but it should just translate the idea to succeed. As discussed below, can you suggest windows? Does this code work against excel on a browser machine or against some excel data on a server?

<? 
$word=new COM("word.application") or die("Cannot start word for you"); 
print "Loaded word version ($word->Version)\n"; 
$word->visible =1; 
$word->Documents->Add(); 
$word->Selection->Typetext("Dit is een test"); 

New efficiencies lie ahead
See the new IBM System x3650 M3 Express$word->Documents[1]->SaveAs("burb ofzo.doc"); 
$word->Quit(); 
?> 

Here is a link to using COM from PHP:

PHP: COM

+1
source

.csv( -) , .

0

Our answer is to save them as is in the database and convert them to <BR> for display on the web page. Thus, if a non-web application is viewing data, it will be displayed semi-correctly without changes. Yes, some things will not always be displayed correctly for the program, but they will be displayed on the web page.

-1
source

Source: https://habr.com/ru/post/1750739/


All Articles