Welcome to WebmasterWorld Guest from 22.214.171.124
An excel file is just a tab delimited file at it's most basic and the rows are delimited by carriage returns.
So being cautious of extra white space write a loop that will set up the first row with column headers if you want them. DO NOT name the first column just id if you want id use, store_id or something as Microsoft will think it is a different file if it starts with id for some reason.
So the code should look something like You will have to PHP this if that is what you are using:
header_array = ['column1', 'column2', 'column3', 'column4']
data = sql_execute('select column1, column2, column3, column4 from table where condition = condition')
for value in header_array:
for value in data:
So what you will want to do is give the user a link or a form to submit and make this page the landing page.
Their browser will see the .xls file extension and ask the user want they want to do with the file. The file will be written and sent to the browser without a copy having ever really been made on your server.
I hope this will work for you.
i have some problems with your method. everything thats inside the example.xls file will not be evaluated. so even if i put php code into it, it wil just display it as text. thanks anyway, regardless.
your script seems to work ok. i think i'll build on that and see how it goes.
i appreciate your help.