/    Sign up×
Community /Pin to ProfileBookmark

conversion of data from database to MS-excel using php

Hi All
I have some 60 employees data in my database and i want to generate reports for these employees on monthly basis in excel format using php . Will anybody help me , how to proceed.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@codebudoSep 20.2007 — The easies thing to do is produce a file of comma separated values (CSV) and then import that into excel. If you really need to have excel formatting and multiple sheets and such, you'll need to use an excel generating php library. If this is just for your own use and with such a small number of employees, the CVS option is much easier.




---
http://www.codebudo.com
Copy linkTweet thisAlerts:
@NogDogSep 20.2007 — To add to the preceding reply, if you're running PHP 5 there is a [url=http://www.php.net/fputcsv]fputcsv() function[/url] which makes this fairly easy. All you need to do is read each row as an array with mysql_fetch_assoc() or mysql_fetch_row() (or comparable functions if using another DBMS), and output each row via the fputcsv() function.
×

Success!

Help @rohitsing spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...