I need to open an excel file in Excel online on a button click which I retrieves from Document library .

I have followed this, but it shows me an Error page like 'Item does not exist. It may have been deleted by another user.'

Please suggest.

  • Do you want to do by Code with JSOM or Rest ? Or just to do in OOB ? – Sukumar MS Mar 19 '19 at 10:04
  • JSOM or REST both will work for me! – Tezz Chaudhary Mar 20 '19 at 11:08
  • If OOB is available for this, then please do suggest... – Tezz Chaudhary Mar 20 '19 at 11:18
  • With help of modern experience applied in your libraries you can open excel online. – Sukumar MS Mar 21 '19 at 9:52

I have done it something like this, please suggest if this is a good approach or not?

   <a id="openExcel" target="_blank" onclick=excelOpen("' + objItems[i].__metadata.uri + '");>Click to view </a>' + '</td>'; 

function excelOpen(path){//,type
var p = GetDocUID(path);
function GetDocUID(path){
var defReturn = $.Deferred();
var url = path+"?&$select=ServerRedirectedEmbedUrl";
    url: url,
    type: "GET",
    headers: {
      "accept": "application/json;odata=verbose",
    success: function(results) {
    error: function(error) {
      console.log("Error in getting List: " + listName);
return defReturn.promise();
| improve this answer | |

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.