# Box, Google Cloud Storage, and Google BigQuery recipe

This use case guides you through connecting Box, Google Cloud Storage, and Google BigQuery to create a powerful automation.

# What does this recipe do?

This recipe monitors a Box folder for new CSV files, downloads each file’s contents, uploads the content to Google Cloud Storage, and then loads the data into a Google BigQuery table.

flowchart TD subgraph Configuration[" "] direction TB subgraph BoxTrigger[&nbsp Box New event in folder trigger &nbsp] Trigger(Trigger) --- setup1(setup) end subgraph BoxAction[&nbsp Box Download file action &nbsp] Action1(Action) --- setup2(setup) end subgraph GoogleCloudStorage[&nbsp Google Cloud Storage Upload object action &nbsp] Action2(Action) --- setup3(setup) end subgraph GoogleBigQuery[&nbsp Google BigQuery Load data from Google Cloud Storage into BigQuery action &nbsp] Action3(Action) --- setup4(setup) end end CreateRecipe([Create recipe]) -- Configure your recipe --> Configuration --> Workflow([Automated workflow]) BoxTrigger --> BoxAction --> GoogleCloudStorage --> GoogleBigQuery classDef default fill:#fff,stroke:#67eadd,stroke-width:2px; classDef WorkatoTeal fill:#67eadd,stroke:#b3e0e1,stroke-width:2px,color:#000; classDef SubgraphDash fill:#e1fffc,stroke:#f66,stroke-width:2px,color:#000,stroke-dasharray: 5 5 class CreateRecipe,Trigger,setup1,Action1,setup2,Action2,setup3,Action3,setup4,Workflow WorkatoTeal class BoxTrigger,BoxAction,GoogleCloudStorage,GoogleBigQuery SubgraphDash

# How can I use this recipe?

This recipe provides a versatile approach for handling CSV data, facilitating automated workflows between Box, Google Cloud Storage, and Google BigQuery. Consider the following usage examples for different departmental needs:

  • Track marketing campaigns: Simplify campaign performance data collection and analysis. By storing CSV files with metrics in Box, you can integrate your data with Google BigQuery to create detailed reports and dashboards.
  • Manage sales leads: Automatically transfer sales leads or customer data from CSV files saved in Box. This provides sales teams with the latest data in Google BigQuery and improves sales tracking and performance monitoring.
  • Monitor operational KPIs: Automate the upload of operational logs or supply chain data from Box to Google BigQuery. This helps operations managers monitor key performance indicators and identify areas for process improvement without manual data entry.

# Create your recipe

Complete the following steps to create a recipe that monitors a Box folder for new CSV files, downloads each file’s contents, uploads the content to Google Cloud Storage, and then loads the data into a Google BigQuery table:

USE CASES ARE INTENDED AS EXAMPLES ONLY

This use case is intended to serve as an example. Recipe modifications such as trigger and action configuration and conditional logic may require adjustments if you plan to include this recipe in your own workflow.

1

Sign in to your Workato account and go to the workspace project where you plan to add the recipe.

2

Set up connections for Box, Google Cloud Storage, and Google BigQuery in the following sections:

Set up your Box connection.

The Box connector supports both OAuth 2.0 and client credentials authentication.

Complete the following steps to set up your Box connection using OAuth 2.0 authentication:

1

Click Create > Connection.

2

Search for and select Box as your connection on the New connection page.

3

Provide a name that identifies which Box instance Workato is connected to in the Connection name field.

Box Connection 1Create your connection

4

Use the Location drop-down menu to select the project where you plan to store this connection.

5

Use the Authentication type drop-down menu to select OAuth 2.0.

6

Optional. Expand Advanced settings to select Requested permissions (Oauth scopes) options.

You can select from the following scopes:

  • Read files and folders
  • Read and write files and folders
  • Manage app users
  • Manage managed users
  • Manage groups
  • Manage webhooks
  • Manage enterprise properties
  • Manage retention policies
  • Global content manager
  • Admin can make calls on behalf of users
  • Manage signature requests
  • Manage Box Relay
7

Click Connect. This opens the Box sign in dialog.

8

Enter your Box account email address and password.

Box Connection 2Log in to Box

9

Click Authorize.

10

Review the requested permissions and click Grant access to Box.

Grant access to BoxGrant access to Box

Set up your Google Cloud Storage connection.

You must have a service account to create a Google Cloud Storage connection in Workato.

1

Click Create > Connection.

2

Search for and select Google Cloud Storage as your connection on the New connection page.

3

Provide a name that identifies which Google Cloud Storage instance Workato is connected to in the Connection name field.

Connect to Google Cloud StorageConnect to Google Cloud Storage

4

Use the Location drop-down menu to select the project where you plan to store this connection.

5

Enter a valid Google Cloud Platform project ID in the Project identifier field. You can find the project ID in the Google Cloud Console (opens new window) by clicking Select a project in the navigation menu.

6

Enter the email address of the service account in the GCS Project service account email field.

7

Provide the private key from the downloaded JSON file in the Private key field. You must copy the private key from -----BEGIN PRIVATE KEY----- to -----END PRIVATE KEY-----.

8

Optional. Enter a comma-separated list of buckets the connection can access in the Restrict to bucket field. For example, bucket-1,bucket2.

9

Optional. Expand Advanced settings and use the Requested permissions (OAuth scopes) drop-down menu to select the permissions to request for this connection.

10

Click Sign in with Google.

Set up your Google BigQuery connection.

The Google BigQuery connector supports both OAuth 2.0 and service account authentication.

Complete the following steps to set up your Google BigQuery connection using OAuth 2.0 authentication:

1

Click Create > Connection.

2

Search for and select Google BigQuery as your connection on the New connection page.

3

Provide a name that identifies which Google BigQuery instance Workato is connected to in the Connection name field.

Connect to Google BigQueryConnect to Google BigQuery

4

Use the Location drop-down menu to select the project where you plan to store this connection.

5

Use the Authentication type drop-down menu to select OAuth 2.0.

6

Click Sign in with Google.

3

Click Create > Recipe.

4

Provide a name for your recipe in the Name field and select the project in which you plan to store the recipe from the Location drop-down menu.

5

Ensure that Trigger from an app is selected under Pick a starting point and click Start building.

Set up your recipeSet up your recipe

6
Set up your Box New event in folder trigger.
1

Search for and select Box in the Choose an app search box.

Choose Box as your appChoose Box as your app

2

Select New event in folder as your trigger.

Select the New event in folder triggerSelect the New event in folder trigger

3

Select the Box connection you created in the preceding steps.

4

Use the Folder drop-down menu to select the folder you plan to monitor for events.

5

Use the Events to monitor drop-down menu to select File uploaded.

6

Click the Set trigger condition toggle.

7

Map the Box Name | Step 1 datapill (nested under the File/folder source object) to the Trigger data field.

Configure the trigger conditionConfigure the trigger condition

8

Use the Condition drop-down menu to select ends with.

9

Enter .csv in the Value field.

10

Click Save.

Step summary

This trigger monitors Box for newly uploaded CSV files, activating the recipe only when the file name ends with a .csv extension.

7

Click the + Add step button and select Action in app.

Add actionClick Add step > Add action in app

8
Set up your Box Download file action.
1

Search for and select Box in the Choose an app search box.

Choose Box as your appChoose Box as your app

2

Select Download file as your action.

Select the Download file actionSelect the Download file action

3

Map the Box ID | Step 1 datapill (nested under the File/folder source object) to the File ID field.

Map the file IDMap the file ID

4

Optional. Specify the Chunk size and unit (for example, B, KB, MB) for file transfer. The default is 10MB, with a minimum of 32KB and a maximum of 10MB. Larger chunk sizes improve throughput but may exceed API limits.

5

Click Save.

Step summary

This step downloads the contents of the CSV file uploaded to Box.

9

Click the + Add step button and select Action in app.

10
Set up your Google Cloud Storage Upload object action.
1

Search for and select Google Cloud Storage in the Choose an app search box.

Choose Google Cloud StorageChoose Google Cloud Storage

2

Select Upload object as your action.

Select the Upload object actionSelect the Upload object action

3

Select the Google Cloud Storage connection you created in the preceding steps.

4

Use the Bucket name drop-down menu to select the bucket where you plan to upload the Box CSV file contents.

5

Enter a name for the object in the Name field, map the Job ID | Properties datapill, and append .csv to specify the file extension.

Configure the object nameConfigure the object name

The Job ID datapill is a default property. Mapping it to the name helps identify which job processed the object.

6

Map the Box File contents | Step 2 datapill to the Object content field.

7

Click Save.

Step summary

This step uploads the Box CSV file contents to a bucket in Google Cloud Storage using file streaming.

11

Click the + Add step button and select Action in app.

12
Set up your Google BigQuery Load data from Google Cloud Storage into BigQuery action.
1

Search for and select Google BigQuery in the Choose an app search box.

Choose Google BigQueryChoose Google BigQuery

2

Select Load data from Google Cloud Storage into BigQuery as your action.

Select the Load data from Google Cloud Storage into BigQuery actionSelect the Load data from Google Cloud Storage into BigQuery action

3

Select the Google BigQuery connection you created in the preceding steps.

4

Use the Project drop-down menu to select the project to be billed for the query.

5

Use the Dataset drop-down menu to select the dataset that contains the table where you plan to load the CSV file data.

6

Use the Table drop-down menu to select the table where you plan to load the CSV file data.

7

Locate the Source URI field and perform the following actions:

1

Enter gs://.

2

Map the Google Cloud Storage Bucket | Step 3 datapill.

3

Enter /.

4

Map the Google Cloud Storage Name | Step 3 datapill.

Configure the Source URIConfigure the Source URI

8

Use the Source format drop-down menu to select CSV.

9

Use the Autodetect drop-down menu to select Yes. This field enables Google BigQuery to automatically infer the schema and options of the data being loaded into the table.

10

Use the Alter table columns when required? drop-down menu to choose Allow field addition and Allow field relaxation. These options enable you to add new optional fields to your schema and change existing required fields to optional.

11

Use the Create disposition drop-down menu to select Create if needed. This options tells Google BigQuery to create the table if it doesn't already exist.

12

Click Save.

Step summary

This step loads the CSV file content data from Google Cloud Storage to a table in Google BigQuery.

Your Box, Google Cloud Storage, and Google BigQuery recipe is ready to test and implement.

GOOGLE BIGQUERY LONG ACTION

This recipe uses the Google BigQuery Load data from Google Cloud Storage into BigQuery action, which is a long action.

When testing a recipe that includes a long action, the job may stall in the Processing status. To avoid this, we recommend starting the recipe instead of using the test recipe function.

Example recipe configuration.

Box, Google Cloud Storage, and Google BigQuery recipeBox, Google Cloud Storage, and Google BigQuery recipe


Last updated: 11/7/2024, 4:54:15 PM