Office Scripts Open Excel file in Desktop - excel

Dears,
In Excel webapp, there is a menu button to open the Excel file in desktop app.
Can this action be done in Office Scripts? Open Excel file in Desktop?
main(workbook: ExcelScript.Workbook) {}

I answered the question here already. But for people landing on this page here it is.
See Office URI Schemes
To open an Excel file you can do something like this:
ms-excel:ofe|u|https://locationofthefile.com/file.xls
Use ofe to open a file and edit or ofv to open a file and view.
There are more complex options as you can read in the docs. But this will probably do it for the most cases
Application
URI
Word
ms-word:
Power Point
ms-powerpoint:
Visio
ms-visio:
Access
ms-access:
Project
ms-project:
Publisher
ms-publisher:
SharePoint
ms-spd:
Infopath
ms-infopath:

Related

How to open a Power Bi report that is put on Teams from Excel

Hi dear community
I have a question please.
I want to open a Power BI report by clicking on an Excel button, but the problem is that the report is on the server, so we use Sharepoint and teams to get the files.
The .pbix file is also put on Teams and I don't know how to open it directly from the Excel button.
The report used to be local so I used this code to open it:
Sub cmdOpen_Click()
VBA.Shell "C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe C:\Users\nizar\Desktop\KPI.pbix"
End Sub
But now the report is on Teams, please Help.
PS: I can open it as a link, but it will only lead me to Teams where the report is placed, but I want it to open it directly on the application.
A Teams folder is actually a Sharepoint folder in disguise:
So you should be able to browse to the folder that contains your file in Teams, and then using the menu you should be able to select "Open In Sharepoint":
From there, you would use the normal methods of converting a Sharepoint address into a file location.
For example:
https://yoursite.sharepoint.com/sites/sitename/document_library/subfolder/test.pdf
Would become:
\\yoursite.sharepoint.com#ssl\sites\sitename\document_library\subfolder\test.pdf

Launch an add-in systematically when opening a file

I want to make an Excel Online file, then post its link or embed it in my website. Clicking on that will open the file in Excel Online. Moreover, I want certain Excel add-ins to be installed and even launched automatically.
Does anyone know if it is possible?
If it's impossible with Excel Online, is it possible for a normal .xlsx file (I will make it, and opening it in Windows systematically leads to install an add-in and even launch it)?
If you're looking to automatically open a task pane add-in when the Excel file is opened, check out this article in the documentation: https://dev.office.com/docs/add-ins/design/automatically-open-a-task-pane-with-a-document?product=excel. The Office OOXML EmbedAddin sample provides an example of implementing the autoopen functionality that's described in the article.
Along with Kim's answer to automatic opening of a task pane add-in, you can using OneDrive to handle opening a file in Excel Online using Microsoft Graph.
You're start by uploading you're .xlsx file to OneDrive using an Upload Session. Once you're file is on OneDrive, you can retrieve it's meta-data for the DriveItem. Included in this meta-data will be a webUrl property. This is a URL that, when navigated too, will open your file using Excel Online.

Mimic Sharepoint edit Office file download

When you browse a list of files in Sharepoint using IE and attempt to download the file, you get the option of opening it in read-only or edit mode. When you open the document, Office knows that the file exists in Sharepoint so when you save, it is updated in Sharepoint without the user having to re-upload the file.
I'd like to have this same functionality in a custom website. I have access to Sharepoint and the file list so I'm using the same URL that Sharepoint is to download the file but there's something else happening in Sharepoint that tells the computer to not download a copy of the file but to open it in Office from the Sharepoint URL.
Does anyone know how to mimic this same behavior so I can get a file to be opened in Office from Sharepoint to it can save directly back to Sharepoint?
The special thing about this, is the link:
It's not just http://example.com/document.docx . It's ms-word:ofe|u|http://example.com/document.docx .
Just add ms-word:ofe|u| in front of the link for letting the browser know to open the link with an other Application.
There are other strings for other links.
Open a OneNote-File with:
onenote:http://example.com/document.one
And Excel-Files with
ms-excel:ofv|u|http://example.com/document.xlsx
And just for fun a TeamSpeak Link:
ts3server://example.com
Create URL for MS Office 2010 (and higher) to:
open document in view mode:
ms-excel:ofv|u|http://server.com/path/filename.xlsx
open document in edit mode:
ms-excel:ofe|u|http://server.com/path/filename.xlsx
List of MS Office apps URL scheme names:
ms-word:
ms-powerpoint:
ms-excel:
ms-visio:
ms-access:
ms-project:
ms-publisher:
ms-spd:
ms-infopath:
MS has a good page with explanation:
MS Office Dev Center > Office URI Schemes

How to open a file location in my PC using javascript for Apps for office 2013?

I have created an Task pane app for office 2013 in excel. It has few buttons and labels.
Now I want to open a file location on my PC on clicking of the button. So please tell me the code for it as I'm new to java-script.
As far as I know, there is no existing openFile API in JavaScript for Office, but you can use ajax to call wcf to get string from existing document and use Document.setSelectedDataAsync method to write the got string to the document.

Prevent Excel file download but allow read

We have uploaded an excel sheet to SharePoint 2013 document library.
We can click on this file and it opens in xlviewer.aspx page
We can also enter the url as http://sharepointsite/shared documents/docname.xls and the file will get downloaded.
Is there any way in which we can prevent download but allow users to view the file.
One solution is to put the excel sheet as a excel services webpart on a SharePoint site page.

Resources