Using Azure ML Predictions in Google Spreadsheet

This post is authored by Raymond Laghaeian, Senior Program Manager at Microsoft.

In this post, we will enable a Google Spreadsheet to call an Azure ML API for real-time predictions.

Setup Steps

  1. Create a new Google Spreadsheet.
  2. Go to Tools > Script editor.
  3. Replace the code with the sample code (location info below).
  4. Save As Call Azure ML.
  5. Return to the Spreadsheet, and refresh.
  6. The Azure ML menu option should appear.
  7. Import the sample data file (location info below).
  8. Click on Azure ML, then Predict Income.

Sample Code and Data

The script and sample input data can be found on GitHub: 

  • After creating a new spreadsheet, import the sampledata.csv input data for step 7 above.
  • Code.txt includes the script that needs to be pasted into the Script editor in step 3 above.

About the APIs

Azure ML provides web service APIs for doing predictions in real-time and batch mode. The APIs can be called from a variety of platform and languages.

About the Machine Learning Model

In this examples, we are using a sample experiment from the Cortana Intelligence Gallery to build the model. The experiment uses publicly available census data to predict the probability of a person making more than, or less than or equal to, $50K.

How to Create Your Own Prediction APIs

Go to Azure ML, and build an experiment (from samples or from scratch). Then deploy it as a web service. Modify the script in this example by updating the API Key, API Post URL, and the Request Payload with the info for your web service. You can get this information from the web service dashboard and API help page. More information is available in the resources below:

@raymondlag, LinkedIn