Set Azure PlayFab Title Data from Google Sheets with No Code
Tags: gamedev, azure, playfab
Published: 2022-01-18 04:20:54

---
title: Set Azure PlayFab Title Data from Google Sheets with No Code
published: true
description: 
tags: gamedev, azure, playfab
//cover_image: https://direct_url_to_image.jpg
---

So recently I've seen a lot of people in the Azure PlayFab community ask how they could create a workflow that takes data that is stored online in Github, Google Sheets, or other files and publish to PlayFab.  For example, your game designer might want to tune the experience that is required to reach a level.  The game designer is using Google Sheets to store this information.  You could go straight into the Game Manager to update this, but it might be better to do this in a more automated way with clear separation of roles on the team. One of my favorite ways to automate tasks like these is with Azure Logic Apps.

### What is Azure Logic Apps
[Azure Logic Apps](https://docs.microsoft.com/azure/logic-apps/logic-apps-overview) provides a serverless engine to build visual automated workflows to integrate apps and move data between applications, usually with little transformation. You build workflows using a visual designer.  This means the following tasks can be done with no code:

-  Sending a weekly news summary or leaderboard updates to all players via Discord, email, or other channels.
-  Automatically notifying team when a player is removed from game due to bad behavior or other moderation issues.
-  Exporting [PlayStream](https://docs.microsoft.com/gaming/playfab/features/automation/playstream-events/) and other Telemetry events into Excel or Google Sheets for analysis
-  Monitoring tweets or other social media activity of your game, analyze the sentiment, and create alerts or tasks for the team to review.

### How Azure Logic Apps works 
At it's core, Azure Logic Apps is just a series of steps, or workflow, to define a process. Each workflow is started by a trigger.  This could be an event, such as when a someone Tweets about your game, or a scheduled time that occurs daily/weekly, or it could even be run on-demand using an HTTP request.  

Once an event is triggered, the workflow begins to run the tasks that you've created.  You can pick from the over 400+ [connectors ](https://docs.microsoft.com/azure/connectors/managed) as well as using the [built-in actions](https://docs.microsoft.com/azure/connectors/built-in) to achieve powerful integrations for your game.  One of the built-in connectors is Azure Functions, so you could combine your [CloudScripts](https://docs.microsoft.com/gaming/playfab/features/automation/cloudscript-af/) with other actions in a visual manner.

### Prerequisites
- Azure Subscription - if you don't have one you can sign up for a [free account](https://azure.microsoft.com/free/)
- PlayFab account - you can sign up [here](https://developer.playfab.com/sign-up)

### Let's Do This

Okay, enough talk, let's go ahead and get started with our first workflow. As mentioned earlier, we want to create a workflow that updates PlayFab Title Data from a Google Sheet that the Game Designer manages. 

Because [PlayFab Title Data](https://docs.microsoft.com/gaming/playfab/features/data/titledata/) is stored as key/value pairs, and our data is stored in Google Sheets, we'll need to convert it to JSON and then send to PlayFab.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rgxajz9jdnt07d98zule.png)

I log in to the [Azure Portal](https://portal.azure.com), search for Logic Apps and create. 
![Azure Logic App Create screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hs4avntkd736ds9dbavt.png)
Fill in the required information:
**Resource Group** - resource group is a logical grouping of Azure Services together so that they can managed together.  Just enter a name that makes sense.
**Type** - we're going to select Consumption for now as it makes the most sense for now.  For more on pricing options for Azure Logic Apps, check here.
**Name** - Enter a name that makes sense
**Region** - Pick the [region](https://azure.microsoft.com/global-infrastructure/geographies/#geographies) that makes the most sense based on your location.
**Enable Log Analytics** - Because I'm just doing a demo, I won't turn on [Log Analytics,](https://docs.microsoft.com/azure/logic-apps/monitor-logic-apps-log-analytics) but definitely when running your Logic App in Test and Production, you should enable Log Analytics.

Fill in the information and Review and Create to complete creating the Logic App. When you go to the resource, you'll see the visual designer.  You'll be prompted with a bunch of triggers and templates.  
![Logic App Designer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n6abu4mmu0izlc8hzncq.png)
In our example we will just check our Google Sheet nightly for updates to the level design.  To do this we'll select the Recurrence Trigger. When the workflow opens, select the Recurrence trigger and change recurrence to 1 time per day and add the At these Hours and At these Minutes parameters as shown below. 
![Azure Logic Apps Recurrence Trigger](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrw7hjsw3lrlco532mpx.png)
First thing I'll need to do in my workflow is connect to Google Sheets.  Click the plus sign to add a new action, search for Google Sheets and select Get Rows - Google Sheets.  Sign in to your Google account to connect and you then will be able to select your Google Sheet.

Next we want to take the items in the Google Sheet and select the values into an array.  For this, we will use the built-in [Select Data Operation](https://docs.microsoft.com/azure/logic-apps/logic-apps-perform-data-operations#select-action). Add another action and search for Select.  In the From field, I will select Records Value.  For mapping, I will create two fields Level and XP and map them to the values in my Google Sheet as shown below:
![Azure Logic Apps Select Data](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4agl363b3cdanwhe7qa.png)

Now that we have the data, we can create a JSON object that we will pass into our PlayFab Title API like this.  To do this, we will use the [Compose action,](https://docs.microsoft.com/azure/logic-apps/logic-apps-perform-data-operations#compose-action) which  creates a single JSON output based on several inputs.  We add another action search for Compose.  We build the input by pasting the following in the inputs field: 
`{
  "Key": "CharacterLevelRamp",
  "Value": ""
}`
Then put your cursor in the Value and select Output from the action above. 
![Azure Logic Apps Compose action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0bxj9xaqydifux5l5nb.png)

For the last step, we will call the PlayFab Set Title Data API with our data.  To do this, add the [HTTP action](https://docs.microsoft.com/azure/logic-apps/logic-apps-perform-data-operations#compose-action) and add the following:
Method - Post
URL - https://**[yourTitleID]**.playfabapi.com/Admin/SetTitleData
Headers - X-SecretKey - **Your Developer Key**
Body - Select Output from previous step above
![Logic App Set Title Data PlayFab Action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jw5cbhpxhugnz2d6p4n.png)
...and that's it!  Now let's test it out. Make sure you save your workflow.  Click Run Trigger to execute your Workflow.  You will see trigger running in Runs History. If all goes well, we will see all green checkboxes. Go into PlayFab --> Title Settings --> Engage --> Content --> Edit Title Data and you should see CharacterLevelRamp set.

![PlayFabTitleData](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekl6k2e7i0fadogaw9bb.png)