2

I am trying to create a button for a SharePoint Site that will open an Excel spreadsheet in Excel online. All of the research I have done on this topic suggests that the easiest way is just to link an image. I would like to use an actual button rather than just linking an image. I use SharePoint Designer 2013, surely there must be a way for me to write a button into the layout of my site manually?...

1

You should be able to create a button using HTML and set the action to open your document. This can be included on a single page using an embedded code webpart, or you can apply it to many pages using SPD (I'm not 100% familiar with doing this, but believe it should be possible).

The HTML would look something like this:

<div>
  <button onClick="openFile()" style="height: 35px; padding: 0;"> 
    Open Excel Sheet 
  </button>
</div>

<script>
function openFile() {
  var url = "https://www.google.com";
  var win = window.open(url,"_blank");
  win.focus();
};
</script>

Or alternatively you could try something like this (credit: https://stackoverflow.com/questions/2906582/how-to-create-an-html-button-that-acts-like-a-link):

<form action="http://google.com">
        <input type="submit" value="Go to Google" />
</form>

In either case, you would replace the url to google with your .xlsx file's URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.