Is there a "Getting Started" tutorial for connecting an Excel workbook to a REST API using OfficeScript?
For querying / updating.
I can connect Excel on Windows to an Azure SQL Server via ADO and VBA. I realise that (these days) we should connect via an API, and with OfficeScript we should (?) be able to do this from any Excel (Windows, web) with OfficeScript. But I can't find any resources on this.
I'm not looking for direction on how to set up the API at this stage.
Thanks.
Unfortunately, Office Scripts does not currently support importing other JavaScript libraries. It would be nice, but no. I found this while searching for similar functionality.
Please see here on MSDN: https://learn.microsoft.com/en-us/office/dev/scripts/develop/javascript-objects#use-of-external-javascript-libraries-is-not-supported
EDIT:
Looks like there is some examples of getting data from a REST API after all. Check out this older link here: https://learn.microsoft.com/en-us/office/dev/scripts/develop/external-calls#working-with-fetch
Related
I am trying to implement a web application that connects to Microsoft Azure in order to upload files to their cloud storage. The documentation I have been following is Manage blobs with JavaScript v12 SDK in a browser. The tutorial for which is below:
https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser
The documentation explicitly states that to use Azure SDK libraries on a website, you must convert your code to work inside the browser using a bundler. The bundler suggested is parcel-bundler
I have built the project fine, and everything is working in the browser as per the tutorial outlines however I am running into an issue when it comes to obscuring the API Keys.
The alternative tutorial, which explains uploading Azure blobs using Node.js suggests the use of environment variables:
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs
I have done this in my browser tutorial, however, when parcel bundles the project together the full API Keys can be accessed by looking in the source files suggesting they are revealed during the build process of the bundle.
It appears that I need to use a bundler as the functions used for browser use do not exist in the client-side JavaScript.
How do I get around this problem?
You should not be using the API Keys in your browser-based application as it is a major security concern (any user can take a look at the JavaScript files in the browser and extract the keys).
What you should do instead is have an API endpoint which your application can call and this API endpoint should return you a Shared Access Signature (SAS) token. You should then use this SAS token in your application to interact with Azure Storage.
I have an ASP.Net Web application where I embed an interactive Excel spreadsheet. The user should be able to interact with the spreadsheet. I embedded the spreadsheet with code from Office Support. The embedding itself works to an extent-- user can click around, but webpage gets no info.
In order to get more info, and be able to write using an ASP.Net Button I turned to an example using the Excel Services ECMAScript (JavaScript) API. The one thing causing problems is the line:
var fileToken = "SD310A16DD64ED7E41!112/3533661997762444865/";
I tried finding the token using the example here.
The embed code in this particular example is:
<iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" width="402px" height="346px" style="padding:0;background-color:#fcfcfc;" src="https://r.office.microsoft.com/r/rlidExcelEmbed?su=-5430218907388983095&Fi=SDB4A3FCAC9C7848C9!285&ak=t%3d0%26s%3d0%26v%3d!AJHqJpkd-Q5axR8&kip=1"></iframe>
and the file token is:
SDB4A3FCAC9C7848C9!285/-5430218907388983095/t=0&s=0&v=!AK3ybHnbJCLh5H0.
This example was not helpful at all because my embed code is of the form:
https://onedrive.live.com/embed?resid=2EE19DD0B45C2F85%2156366&authkey=%21AC2IkSn6J6_kejU&em=3&wdDivId=%22myExcelDiv%22&wdDownloadButton=1&wdHideGridlines=1&wdHideHeaders=1&wdAllowInteractivity=0&wdAllowTyping=1.
Therefore it has been pretty impossible to find the token in the manner of the example.
I tried using 2EE19DD0B45C2F85%2156366 as the file token but the code I copied from the ECMAScript API returns the error: Async operation failed!.
How can I find the file token for my embedded Excel spreadsheet?
Okay after a lot of digging around I finally got how to gain control of the embedded excel in Javascript.
Technically this may not answer your question "How to get the file token for the embedded excel spreadsheet", but I'm assuming you want that token to control the embedded excel in javascript.
Instead of initializing the embedded excel through the EWA instance, you want to initialize the excel using the javascript embed code that you will find on onedrive. Then after the instance is application ready (you can find out how to attach a callback to this in the link below) you can simply fetch the instance of the embedded excel using this
ewa = Ewa.EwaControl.getInstances().getItem(0);
More information at this link: https://github.com/SharePoint/sp-dev-docs/blob/master/docs/general-development/working-with-the-excel-services-javascript-object-model.md
It appears that the example you were using is based on an earlier version of the One Drive JavaScript API, from MS SharePoint 2010.
Microsoft have since superseded it with the OneDrive Developer Platform (part of their Microsoft Graph APIs).
Check out the official docs here: MS OneDrive Developer Platform.
I've also been recently searching for a JavaScript-only solution to sharing spreadsheets online with more functionality than the embed option allows. ODDP appears to be the way forward.
Given Excel online is an excellent spread sheet implementation for the web, it would be desirable to use it as a spread sheet component in web applications.
We are using an angularjs frontend and an ASP.NET backend and would like to use Excel online essentially as a spread sheet component inlined into the web app.
Browsing the web, I don't see any suggestion on how to integrate Excel online into my own web application. Has anyone managed to do it?
We can use WOPI protocol to integrate with Office Online in our web application. Here are two figures show you how it works:
And you can get a sample code to implement the WOPI server from here. And below are some helpful links for you get started:
https://blogs.msdn.microsoft.com/officedevdocs/2013/03/21/introducing-wopi/
https://wopi.readthedocs.io/en/latest/
I am currently trying to get my head around database's and web programming.
I currently have 3 files index.html, script.js (empty at the minute) and test_db.sqlite.
I am trying to pull info from the sqlite database, create a javascript variable with the info and the print it to the html with the document.getElementById method.
What I'd having trouble with is reading the database using javascript. I am willing to use jquery or any other extra JS scripts, but I cannot use php as I intend to use this to create a cross platform app with a python web wrapper on windows & linux and phonegap for iOS and Android.
I also need to figure out to write to the database with javascript.
Thank you for any help in advance.
You have to dump the database (you can use .dump command in sqlite3)
Then you can send that dump to de front-end (the navigator)
You can use WebSql API to create the database and execute all commands of the dump to recreate
Warning, this does'nt work in Firefox. It works only in Chrome and Safari
I know this topic is not new. I've seen and read some of the articles and resources discussing and even have the demo on how to stream the Kinect data to web browser.
I have an application written in VB.NET and I wanted to ONLY stream the RGB to the web browser. I couldn't find a detailed explanation on how I should modify the codes or how to use the plug-in provided step by step.
I have found the source code for streaming skeleton data to web browser and it's working, but now I want to stream the RGB data. I have seen a lot of website talking about node.js and web socket. But the question is how to use them? anybody please answer~ Thanks!