Reply
Access to Excel
Old 05-07-2007, 05:50 PM Access to Excel
WebcyteDesign's Avatar
Extreme Talker

Posts: 159
Location: Hamilton
I'm trying to do a select into statement that send the output to an excel file. The only problem I'm having seems to be that I can't specify the column names, I can only have select * into, I need select field1, field2... into.

It seems like it needs to have the file prior to running the statement the second way, but the first way (w/ *) creates it if it doesn't exist. Please let me know if you know of a way to tell it what fields you;d like to export.
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
When You Register, These Ads Go Away!
Old 05-07-2007, 07:04 PM Re: Access to Excel
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
I've done this a few times before using ASP. What I did was retrieved the data and outputted it to an Excel spreadsheet that was generated on the fly.

Here's a code example that should get you started. However, and this is extremely important, don't insert the Response.ContentType = "application/vnd.ms-excel" line into your code until you're sure that you've got the output working. If you don't, you won't get any output and a cryptic error message that tells you next to nothing (as opposed to the cryptic error message from ASP that can tell you something if you know how to interpret it correctly.)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 05-07-2007, 07:15 PM Re: Access to Excel
Learning Newbie's Avatar
Moderator

Posts: 5,199
Name: John Alexander
Use Visual Basic for Applications code ( aka a module ) to open the query as a recordset, cycle through all the data, and write a CSV file.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 05-07-2007, 09:00 PM Re: Access to Excel
WebcyteDesign's Avatar
Extreme Talker

Posts: 159
Location: Hamilton
Thnxs for the replies but the way I said is the only way I'd like to do it, if it is not possible I know how to do it a number of other ways, I just don't want to have to rewrite all my code.
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
Old 05-08-2007, 10:28 AM Re: Access to Excel
Average Talker

Posts: 29
Name: Amit Soni
Create a view from the table with the columns that you wish to export and then do your select * thing !

That seems to be the quickest way to resolve it.
Zitku is offline
Reply With Quote
View Public Profile Visit Zitku's homepage!
 
Old 05-08-2007, 12:51 PM Re: Access to Excel
WebcyteDesign's Avatar
Extreme Talker

Posts: 159
Location: Hamilton
Thanks Zitku, I had just thought of that this morning, unfortunately I have to wait till tonight to do it, but your responds confirms I'm on the right track, thank you.
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
Old 05-08-2007, 06:34 PM Re: Access to Excel
WebcyteDesign's Avatar
Extreme Talker

Posts: 159
Location: Hamilton
Just thought I'd let you know that creating the view worked, for future reference
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
Old 05-08-2007, 06:45 PM Re: Access to Excel
Average Talker

Posts: 29
Name: Amit Soni
Really? I was actually a bit doubtful it'll work! but anyway, good luck!
Zitku is offline
Reply With Quote
View Public Profile Visit Zitku's homepage!
 
Old 05-14-2007, 02:24 PM Re: Access to Excel
Experienced Talker

Posts: 42
Yeah good luck
Vairo is offline
Reply With Quote
View Public Profile
 
Old 05-15-2007, 01:29 AM Re: Access to Excel
kids's Avatar
Ultra Talker

Posts: 271
How is about php? We can use php to access excel files?
kids is offline
Reply With Quote
View Public Profile Visit kids's homepage!
 
Old 05-17-2007, 05:51 PM Re: Access to Excel
Average Talker

Posts: 29
Name: Amit Soni
yes, PHP can easily handle actual excel files as well as tab separated excel files. Also there is this interesting work done by some russian guy paggard. (paggard.com), who sells his php excel thing. I bought it once long back dont really know about the current status.

-Amit.
Zitku is offline
Reply With Quote
View Public Profile Visit Zitku's homepage!
 
Reply     « Reply to Access to Excel
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.18967 seconds with 12 queries