Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a download-link to an Excel file?

I have an Excel Spreadsheet (.xls) which i want the users to be able to download it from my webpage. Maybe a 'download' button on the page and when users click on it, the file will be downloaded.

May i know how can this be done? Code snippets and references will be appreciated.

like image 871
Lloydworth Avatar asked Jan 06 '12 02:01

Lloydworth


People also ask

How do I make a download in Excel?

Select File • Select Save As • Click on Save as type drop-down box arrow • Select Microsoft Excel Workbook\ • Enter File Name ________ . xls • Select OK. The data is now available for you to use as your needs require.


1 Answers

You can use simple html links:

link:

<a href='/path/to/excel/file.xls' target="_blank">Download</a>

button:

<form>
<input type="button" value="Download" onClick="window.location.href='/path/to/excel/file.xls'">
</form>
like image 56
Naveed Avatar answered Oct 12 '22 12:10

Naveed