Excel(.xlsx) file download on click of a link in html
<p>None of the options are working out so far for me . I am trying to download an excel file on click of an image link.</p>

<p>What I tried was </p>

<pre><code>&lt;div class="export-template-label" style="display:inline-block;margin:5px 5px -8px 0px;"&gt;
    &lt;a href="../../Upload/Files/MyGrpMembership.xlsx" target="_self" download&gt;
        &lt;img src="Images/excel.png" alt="logo" style="float:left;" /&gt;
    &lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>But when I try to open the downloaded file it shows me error saying </p>

<p><a href="https://i.stack.imgur.com/Cvg5C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cvg5C.png" alt="enter image description here"></a></p>