Google spreadsheet direct download link for only ONE sheet as excel

This works just fine although I did find that I had to keep looking up this string and copying it. Instead, I made a quick Javascript snippet that does all the work for you:

Just run the code snippet below and drag the link it creates into your bookmarks bar. I know this is a little hacky but for some reason, stackoverflow doesn’t want me injecting javascript into the links I provide.

<a href="javascript:var%20winURL%20=%20window.location.href;if(winURL.indexOf('/edit#gid=')%20%3E%200)%7Bwindow.location.assign(winURL.replace('/edit#gid=',%20'/export?format=xlsx&gid='));%7Delse%7Balert('Incorrect%20URL%20format');%7D">Export Sheet as Excel</a>