Follow us on Twitter
Follow us in Facebook
Office Dev Content
SharePoint Dev Content
Blogs for Office developers > Apps for Office and SharePoint blog
The API Tutorial for Office teaches you how to get started writing code for an app for Office. The tutorial is an app for Office that runs in Excel or Excel Web App. You can download the app for free from the Office Store, but you can also run it online from the MSDN website. In this post, learn how to get started.
Note: To run the tutorial online, you need to be running at least Internet Explorer 9, Safari 5.0.6, Firefox 5, Chrome 13, or a later version of one of these browsers.
Like all apps for Office hosted on external sites that can read and write to your documents, the first time you run it you need to choose Start:
Figure 1. The New App for Office prompt
Once you've done that, the API Tutorial app opens its first script sample, which will call the setSelectedDataAsync method to write to the spreadsheet. To run that, first select a cell, and then choose Run Code:
Figure 2. Write "Hello World!" to the spreadsheet
Choose Next Step, and then choose Run Code again to call the getSelectedDataAsync method to read data from the selected cell and display it in notification at the bottom of the app:
Figure 3. Read from the selected cell
Clear the notification, and then choose More Tutorials to access tutorials for all six scripting tasks.
Figure 4. Select a tutorial
All six tutorials provide brief descriptions of each code example with links to documentation for key members of API used in the example. To read about the code, choose the Description "tab" right above the Code window:
Figure 5. The code description
In each of the tutorials, you can edit the code in the window and click Run Code to try out something different. Here's a simple example of editing the data parameter string passed to the setSelectedData method to change what's written back to the selected cell:
Figure 6. Editing code
· Inserting tables with different numbers or rows and columns
· Adding rows or columns to a table after it's been inserted
· Getting data from a selection within a binding.
Figure 7. Supported clients
Because the API Tutorial app references the jQuery library (version 1.7.1), you can also use jQuery in your script.
At the end of each tutorial, if you've signed up for an Office 365 Developer Site with the "Napa" Office 365 Development Tools installed on that site, you can choose the Open in Napa button to open the API Tutorial app project in Napa.
Figure 7. Tutorial App open in Napa
The API Tutorial for Office is a great way to get started learning some basic scripting tasks for apps for Office. To learn more, see Build apps for Office and the Apps for Office and SharePoint Dev Center on MSDN.