download spreadsheet

M

mcnewsxp

can i download a spreadsheet from an HTML page? click a link and the csv open in excel?
tia,
mike
 
N

Neil Gould

mcnewsxp said:
can i download a spreadsheet from an HTML page? click a link and the
csv open in excel? tia,
mike
Sure... go ahead, I don't mind! ;-)

Google: html table to excel
 
D

Denis McMahon

can i download a spreadsheet from an HTML page? click a link and the
csv open in excel? tia,

Wrong question.

What a web browser does with a document will depend on a couple of things:

a) What type of document the web browser thinks it is getting (which
might be based on the mime type the server tells it, or the file
extension, or both, prioritising one over the other in the latter case).

b) What the browser is configured to do with that type of document, which
might be some browser default value, user configured, determined by other
installed software, decided by the operating system, save the file or to
ask the user.

Note that (a) above might in turn rely on the configuration of the web
server as to what metadata it sends in relation to given file types,
which it might in turn identify by the file extension or by other means.

Rgds

Denis McMahon
 
J

Jonathan N. Little

mcnewsxp said:
right. is there any way to ensure the browser gets it right with HTML?

1) Learn to quote

2) No

<a href="some.xls">A spreadsheet</a>

As you have been told what happens when someone clicks the above depends on
a) how the *user* has his browsers configured to handle XLS files
b) what software the *user* has installed on *his* system.


You cannot with HTML override a or b. If the user has it setup to
download XLS files only you cannot force him to open it directly in
Excel. Also if the user does not have Excel you cannot force him to
install it.
 
D

Denis McMahon

right. is there any way to ensure the browser gets it right with HTML?

If you control the server, you can at least control how the server
presents the file. i.e. the headers.

However, unless you control the browser configuration, you can not
control how the browser handles the mime type / file type.

That element of browser configuration is usually outside of what you can
control from a web page, for good reason.

If I could control what your browser did when I sent a specific file to
it, I could install any software I wanted on your computer. Thank you for
your banking details, please wait while I transfer all the funds from
your bank to my bank, welcome to my botnet.

Rgds

Denis McMahon
 
J

Jonathan N. Little

mcnewsxp said:
"2) No"

thanks

The basic rule of HTML, and web design in general: you can only suggest
and not force anything on the user. (Hopefully it will stay that way,
power to the people and all...)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top