Update Metrics from Excel

Note: this webhook utilizes Visual Basic, which is only available in Microsoft Excel for Windows.

To automatically update a WorkBoard metric from a value in an Excel spreadsheet, click here to go to WorkBoard's pre-built connector catalogue, and click the Microsoft Excel button.

1. Select the WorkBoard metric you want to update from the value in your Excel spreadsheet.

Selecting a metric to update

2. Copy the code that is generated (see example at right).

3. Also make a note of the "named range" value that will appear in the instructions just below the code (it will look like "WoBo_Metric_{metric_id}", where metric_id is the unique WorkBoard id belonging to the metric you have chosen to update).

4. Go to your Excel spreadsheet, right-click on the cell you want to use as your data source, and select "Name a range." Change the default value to "WoBo_Metric_{metric_id}" (the value you copied in step 3), and click the "OK" button. This will allow you to add rows or columns to your spreadsheet, without disrupting the flow of data into WorkBoard.

Defining the named range

5. Click on the Developer tab in the top row of your Excel window. (If you don't see the Developer tab, click on File -> Options -> Customize Ribbon, and check the box labelled "Developer" under Main Tabs.)

6. Double click on Visual Basic. In the left-hand window (under VBAProject > Microsoft Excel Objects), select either the specific sheet your data cell is on or ThisWorkbook (to apply to the entire workbook). Paste the code you copied in step 2 into the main editor window, click the save button, and exit the editor.

Opening the Excel Spreadsheet Script Editor

6. If it's not already, you'll need to save your Excel sheet as a Macro-Enabled Workbook (.xlsm).

7. You're set! Now whenever there is any update to the cell with the range named "WoBo_Metric_{metric_id}," your changes will be reflected in WorkBoard.

# Example webhook code snippet
Sub updateMetric_{metric_id}()
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
Value = Range("WoBo_Metric_{metric_id}")
URL = "https://myworkboard.com/wb/apis/hook/{webhook_hash}/{metric_id}/" & Value
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHTTP.send ("type=hook")
End Sub