I know is it possible to generate a excel file from a SQL query. But I will like to know if I can use php to query from the database, then write it to a copy of an excel file that is already saved on the server.
I am having trouble figuring out how to create a copy of the saved file on the server.
Any help will be appreciated. Thanks in advance
Writing to a saved file
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
copy()?
I'm going to assume you mean a CSV file. In that case,
fopen('filename', 'at') will allow you to open the file and append to it provided permissions allow it.
I'm going to assume you mean a CSV file. In that case,
fopen('filename', 'at') will allow you to open the file and append to it provided permissions allow it.
I've never worked with excel spreadsheets and php but as far as copying goes have you tried:
http://us2.php.net/manual/en/function.copy.php
http://us2.php.net/manual/en/function.copy.php
Sorry I did not make myself clear abt the format I was explaining.
I am not using CSV as it does not support many advance functions that I will like to save in the excel template on the server. I am trying to copy a bunch of data into a copied excel template which does chart generation using some macros.
I am not using CSV as it does not support many advance functions that I will like to save in the excel template on the server. I am trying to copy a bunch of data into a copied excel template which does chart generation using some macros.
Thanks for the help...
I am wondering if there is a possibility of downloading a file that is stored on the server without using ftp or any webserver management add on.
I tried the following, but it just creates a new excel file for download and not the data.xls that I have stored in the server.
I am wondering if there is a possibility of downloading a file that is stored on the server without using ftp or any webserver management add on.
I tried the following, but it just creates a new excel file for download and not the data.xls that I have stored in the server.
Code: Select all
# file name for download
$filename = "data.xls";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: application/vnd.ms-excel");