Jump to content


Photo

export mysql data to existing xls file


  • Please log in to reply
7 replies to this topic

#1 ozorowsky

ozorowsky
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 October 2005 - 03:33 PM

I have an existing xls file for my work timesheet, and I'm trying to write code to autopopulate the fields there from mysql database. Anyone out there that can get me pointed in right direction?

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 October 2005 - 05:45 PM

Not to an xls file directly ... but you can export MySQL data to a CSV file (or any other separator) very easily, and then import the .csv file into Excel.
Legend has it that reading the manual never killed anyone.
My site

#3 ozorowsky

ozorowsky
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 October 2005 - 09:43 PM

could you PLEASE get me started in dummy terms? I really need a newbie tutorial on how to do this. Keep in mind, I have an existing already formatted xls file, and I need the values to be populated with variables from mysql database.

#4 ozorowsky

ozorowsky
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 October 2005 - 11:45 PM

If it would be helpful I could email you guys the xls file I have. I just don't know what to do.

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 October 2005 - 11:52 PM

As far as I know, you can't create a true .xls file using php/MySQL. What you CAN do is generate a text file from the MySQL data. And then you can IMPORT that text file into Excel.

Assuming you know how to get the data you want out of your database, you'll find all you need to know about creating a text file in the manual - check fwrite for that.
Legend has it that reading the manual never killed anyone.
My site

#6 ozorowsky

ozorowsky
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 19 October 2005 - 12:36 AM

I don't have to create an xls file exactly, just something that will print out EXACTLY like what I currently have. Any way I could send you the file I have through email?

As far as I know, you can't create a true .xls file using php/MySQL.  What you CAN do is generate a text file from the MySQL data. And then you can IMPORT that text file into Excel.

Assuming you know how to get the data you want out of your database, you'll find all you need to know about creating a text file in the manual - check fwrite for that.

View Post



#7 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 19 October 2005 - 02:00 AM

Any way I could send you the file I have through email?

No thanks.

The way we all learn is by sharing knowledge. If you want to post some information about your database structure, and some information about what you want in the .csv file that will result from querying it and creating a text file, then everyone here can contribute to the solution you're working towards, and anyone who reads the thread (now or in future) will see how a particular problem was solved.

That's what these forums are all about: shared problems, shared solutions.
Legend has it that reading the manual never killed anyone.
My site

#8 ozorowsky

ozorowsky
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 19 October 2005 - 03:13 AM

Fair enough. I created this: http://rrtools.redir.../timesheet.html with a html table. What I want to do is have pretty much the timesheet there and have values populated then formatted so that it will print out on one page. Right now this table is alittle too big

No thanks.

The way we all learn is by sharing knowledge.  If you want to post some information about your database structure, and some information about what you want in the .csv file that will result from querying it and creating a text file, then everyone here can contribute to the solution you're working towards, and anyone who reads the thread (now or in future) will see how a particular problem was solved. 

That's what these forums are all about: shared problems, shared solutions.

View Post






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users