Watershed's enterprise climate platform enables you to measure, report, and reduce your organization's carbon footprint.
With the Workiva Platform, you can build chains to automatically download carbon footprint data from Watershed — such as for disclosure in your Environment, Social, and Governance (ESG) or sustainability reporting — into a table, based on a time period specified in a custom Watershed spreadsheet. You can then use the table as a source for a query or spreadsheet connection, such as to include the data in reporting outputs.
Note: While you build multiple chains in these instructions, you'll run only one chain — which then automatically runs the others — to download data from Watershed and update the spreadsheet.
Note: The Watershed spreadsheet used by these chains is provided by Workiva. If you don't have it but are interested, contact your Customer Success Manager for details.
Prerequisites
To build these chains, you'll need these connectors:
- Workiva connector
- Tabular Transformation connector
- JSON connector
- HTTP Request connector
- File Utilities connector
Tip: All of the chains' commands use the default CloudRunner. No GroundRunners are needed.
To successfully run the chains, also identify:
- The key for the activity provider to use to authenticate with and perform actions with the Watershed API
- The IDs of the Watershed spreadsheet, its Control sheet section, and its connected table
Build a chain to log data downloads
To start, build a chain to update the Control sheet section to track when carbon footprint data uploads to Workiva.
Step 1. Create the chain
- From Chains, click Create, and select Create chain.
- In Setup, enter a name of
3. Watershed
and a description to help identify that the chain logs Watershed data uploads. - Click Save.
Step 2. Start with a Runtime Inputs event
- From Chain events, move Runtime inputs to Start.
- Select the Runtime inputs event, and click Edit.
- In Basic info, enter a name and description to help identify the event.
- In Variables, add TextField inputs with these display names:
Range
SpreadsheetID
SheetID
Tip: Leave these variables' default values blank; they'll be generated when you run the 1. Watershed chain created later.
- Select Required for all three variables, and click Save.
Step 3. Add a File Utilities Create File command
To create the log file for the Control Sheet section, add a File Utilities Create file command:
- From Available connectors, select File Utilities, and move Create file to the canvas.
- Drag a link from Runtime inputs to Create file.
- Select the Create file command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the File Utilities connector to use. Text Enter Footprint data last refreshed on
, and select the System.DateTime runtime variable.
Step 4. Add a Workiva Write Sheet Data command
To update the Control Sheet section with the log file, add a Workiva Write sheet data command:
- From Available connectors, select Workiva, and move Write sheet data to the canvas.
- Drag a link from Create file to Write sheet data.
- Select the Write sheet data command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the Workiva connector to use. Spreadsheet ID Select the SpreadsheetID runtime input from Trigger. Sheet ID/name Select the SheetID runtime input from Trigger. Data file Select the Created file output of the Create file command. Delimiter Enter a comma ( ,
).Region Select the Range runtime input from Trigger. - Click Publish, enter a note about its publication, and click Publish.
Build chains from the Load Data to Wdata template
Next, use the Load Data to Wdata template to build chains to update the Watershed spreadsheet's connected table with the data downloaded from Watershed. The Load Data to Wdata template creates chains that work together to determine whether the dataset already exists in the table and update the table with the latest dataset.
To create the chains from Templates, open the Load Data to Wdata | Primary chain template, and click New chain.
Build a chain to download data from Watershed
Finally, build a chain to download and import carbon footprint data from Watershed.
Note: Create the other two chains before this one, for its Run chain events.
Step 1. Create the chain
- From Chains, click Create, and select Create chain.
- In Setup, enter a name of
1. Watershed
and a description to help further identify the chain. - In Variables, add variables for the Watershed API key and the IDs of the Watershed spreadsheet and its control sheet.
Name Value APIKey Enter the Watershed API key. SpreadsheetID Enter the ID of the Watershed spreadsheet. SheetID Enter the ID of the Control sheet section of the Watershed spreadsheet. - Click Save.
Step 2. Start with a Workiva Get Sheet Data command
Start with a Workiva Get sheet data command to identify the data to download, based on the time period in the Watershed spreadsheet's Control sheet:
- From Available connectors, select Workiva, and move Get sheet data to Start.
- Select the Get sheet data command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the Workiva connector to use. Spreadsheet ID Select the Spreadsheet ID chain variable. Sheet ID/name Select the Sheet ID chain variable. Region Enter A11:
.Value style Select Calculated. Revision To ensure the latest version, enter -1
.
Step 3. Add commands to prepare time period for Watershed
To identify the time period for Watershed, add Advanced query and CSV to JSON commands:
- From Available connectors, select Tabular Transformation, and move Advanced query to the canvas.
- Drag a link from Get sheet data to Advanced query.
- Select the Advanced query command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the Tabular Transformation connector to use. Tables Add the table for the time period data: - In File, select the Data output of the Get sheet data command.
- In Table name, enter
a
.
Query Enter the query to run: select case when `Start Month` = 'January' then '01' when `Start Month` = 'February' then '02' when `Start Month` = 'March' then '03' when `Start Month` = 'April' then '04' when `Start Month` = 'May' then '05' when `Start Month` = 'June' then '06' when `Start Month` = 'July' then '07' when `Start Month` = 'August' then '08' when `Start Month` = 'September' then '09' when `Start Month` = 'October' then '10' when `Start Month` = 'November' then '11' else '12' end as 'sm', case when `End Month` = 'January' then '01' when `End Month` = 'February' then '02' when `End Month` = 'March' then '03' when `End Month` = 'April' then '04' when `End Month` = 'May' then '05' when `End Month` = 'June' then '06' when `End Month` = 'July' then '07' when `End Month` = 'August' then '08' when `End Month` = 'September' then '09' when `End Month` = 'October' then '10' when `End Month` = 'November' then '11' else '12' end as 'em', `Reporting Year` as 'ry', TableId as 'tid' from a
Input delimiter Select Comma. Output delimiter Select Comma. Preview results Select this checkbox. - From Available connectors, select JSON, and move CSV to JSON to the canvas.
- Drag a link from Advanced query to CSV to JSON.
- Select the CSV to JSON command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the JSON connector to use. Input file Select the Result output of the Advanced query command. Delimiter Select Comma (,).
Step 4. Add an HTTP Request GET command
To download carbon footprint data for the selected time period, add an HTTP Request GET command:
- From Available connectors, select HTTP Request, and move GET to the canvas.
- Drag a link from CSV to JSON to GET.
- Select the GET command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the HTTP Request connector to use. Show response Select this checkbox. URL Enter https://api.watershedclimate.com/v1/report/footprint_detail
.Query string Enter the query string to indicate the start and end months of the data to download: - For the start month, enter
startMonth=
, and select the JSON file output of the CSV to JSON command twice. - Then, for the end month, enter
&endMonth=
, and select the JSON file output of the CSV to JSON command two more times. - For both months, click the first JSON file output, and apply a Get variable from JSON transformation:
- In Output, select Text.
- In Value, enter
0
andry
.
- For both months, click the second JSON file output, and apply another Get variable from JSON transformation:
- In Output, select Text.
- In Value, enter
0
andsm
.
Headers Add a header: - In Key, enter
Authorization
. - In Value, enter
Bearer
, then select the APIKey chain variable.
Content type Enter application/json
. - For the start month, enter
Step 5. Add Run chain events to perform and log the data upload
To upload the data into Wdata and log the upload in the Control sheet section, add Run chain events for the chains created earlier:
- From Chain events, move Run chain to the canvas.
- Drag a link from GET to Run chain.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to help identify that the event uploads the data into Wdata.
- In Chain to run, select Load Data to Wdata | Primary chain created earlier from the Load Data to Wdata template.
- Enter the chain runtime inputs, and click Save:
Input Value Table ID To provide the ID of the Wdata table to upload the data to: - Select the JSON file output of the CSV to JSON command.
- Click the JSON file output, and apply a Get variable from JSON transformation:
- In Output, select Text.
- In Value, enter
0
andtid
.
File prefix To define the prefix of the dataset to upload, based on the data's time period: - For the start month, select the JSON file output of the CSV to JSON command twice.
- Enter an underscore (
_
). - For the end month, select the JSON file output of the CSV to JSON command two more times.
- Enter
.csv
. - For both months, click the first JSON file output, and apply a Get variable from JSON transformation:
- In Output, select Text.
- In Value, enter
0
andry
.
- For both months, click the second JSON file output, and apply another Get variable from JSON transformation:
- In Output, select Text.
- In Value, enter
0
andsm
.
Data file Select the Response output of the GET command. Load method Select Replace dataset. Rollback Select this checkbox. - From Chain events, move another Run chain to the canvas.
- Drag a link from the first Run chain to the second.
- Select the second Run chain event, and click Edit.
- In Basic info, enter a name and description to help identify that the event logs the data upload in the Watershed spreadsheet.
- In Chain to run, select the 3. Watershed chain created earlier.
- Enter the chain runtime inputs, and click Save:
Input Value Range Enter F12:F12
.Spreadsheet ID Select the SpreadsheetID chain variable. Sheet ID Select the SheetID chain variable. - Click Publish, enter any notes about its publication, and click Publish.
Run the chains
To refresh the Watershed spreadsheet with the latest carbon footprint data:
- From the Control sheet section of the Watershed spreadsheet, select the time period — months and year — of the data to download from Watershed.
- From Wdata Chains, select the 1. Watershed chain, and click Execute and Run chain.
Note: When you run this chain, it automatically runs the two other chains to update the Wdata table and Watershed spreadsheet with the data.