By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,170 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

Saving as csv file

mehj123
P: 55
Hi,

I want to save data in a html table in the .csv format. I am able to save the data in a normal text file by using the command
Expand|Select|Wrap|Line Numbers
  1. <button onclick="javascript:document.execCommand('SaveAs','1','FraudReport.txt')">Click to save</Button>
I want to save the same in .csv format.
Thanks
Oct 15 '07 #1
Share this Question
Share on Google+
4 Replies


gits
Expert Mod 5K+
P: 5,390
hi ...

execCommand is IE specific and will not work with other browsers ... probably you should do that on serverside ...

kind regards
Oct 15 '07 #2

mehj123
P: 55
hi ...

execCommand is IE specific and will not work with other browsers ... probably you should do that on serverside ...

kind regards
Oh.. so is there any other way to do this?
Oct 15 '07 #3

Expert 100+
P: 392
Oh.. so is there any other way to do this?
Yes, just not with JavaScript. Most browsers will not let you save files, or directly write to disk via JavaScript logic. It is too much of a security risk. IE will let you do it if you lower the browsers security settings to a point that is not safe for general use.

The best way to do this would be to use a server side language (PHP, Python, C#, ASP.NET, etc.) to create the file, and have the user save the file though their browser.
Oct 15 '07 #4

mehj123
P: 55
Thanks a lot ... I am now trying to do it in server side.. :)
Oct 16 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.