Jump to content
Stef's Coding Community

Convert data into excel format


Recommended Posts

What I meant was from the user's point of view.

 

For the project I am working on, one of my requirements is to save selected data in excel format.

The end-user selects the data to be printed or saved.

And I need the code for the same.

 

 

It is not from the admin's point of view.

 

Sorry if I didn't mention it.

Link to post
Share on other sites
  • 2 weeks later...

You can do this a number of ways using PHP...

 

Look at fwrite

 

[example]...

$f = fopen('/tmp/data.csv', 'a'); //<< in 'a' append mode
fwrite($f, 'line of data 1'); //<< you will have to loop through this line
fclose($f); // close handle

 

Or using a MYSQL query...

 

[example]...

SELECT field1,field2,field3
FROM table
INTO OUTFILE '/tmp/data.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'

Edited by is_numeric
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...