I am trying to read from an excel file to use the data in SharePoint. I recently discovered the Javascript API for Office however I can't reference the library without an error. I use the following html reference:

<script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js"/>

My browser responds with Uncaught TypeError: window.external.GetContext is not a function.
Thanks in advance for the help.

1 Answer 1


The script element can't be self-closed.
Try <script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js"></script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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