BLOCKS Reference

Block Reference


Load to variable from GCS

warning This BLOCK is currently in beta. Be aware that the beta version will become unavailable post official release. *Please make use of the official BLOCK once released.

As a beta release, there is the possibility that some functions may not execute properly. We appreciate feedback from users, through the BLOCKS Forum or direct contact, regarding bugs or ways to improve BLOCKS.

This BLOCK reads a file stored into Google Cloud Storage (GCS) and sets a variable as the file’s contents.

Load to variable from GCS

As an example, assume a text file with the following contents has been stored to GCS at gs://magellan-sample/files.txt


By using this BLOCK to process the file, we can set a variable to the following data:

  "gcs_url": "gs://magellan-sample/files.txt",
  "timestamp": 1480986550.0,
  "content": "sample1.png\nsample2.png"

The variable's data includes the file's contents as well as other relevant information as JSON format data. The "content": "sample1.png\nsample2.png" portion refers to the actual contents of the file. (\n means new line)

Select between (None) / YAML / JSON / Binary (Base64) as the file's format.

  • When the format is (None), "content" is set as the contents of the file just as they are.
  • If the file's format is YAML or JSON, "content" is set as the results of analyzing its contents based on that format.

    For example, assume the following YAML format text file is saved to GCS at gs://magellan-sample/block_lists.yaml

     - Start of Flow
     - Parallel Branch
     - Slack Notice
     - Output to Log
     - Construct Object
     - End of Flow
     - HTTP GET
     - HTTP POST
     - HTTP PUT

    The results variable will contain the following data after the BLOCK processes this file:

      "gcs_url": "gs://magellan-sample/block_lists.yaml",
      "timestamp": 1481009942.0,
      "content": {
        "Basic": [
          "Start of Flow",
          "Parallel Branch",
          "Slack Notice",
          "Output to Log",
          "Construct Object",
          "End of Flow"
        "API": [
          "HTTP GET",
          "HTTP POST",
          "HTTP PUT",
          "HTTP DELETE"
  • For files of type Binary (Base64), "content" is set to the contents of the file as Base64 encoded data.

    A shortened example of such data is shown below:

      "content": "ZkxhQwAA......qqA55Q=="

Property Explanation
BLOCK name Configure the name displayed on this BLOCK.
GCP service account Select the GCP service account to use with this BLOCK.
Source file GCS URL Designate the GCS URL of the file whose contents will be set as a variable. Example: gs://magellan-sample/sample.yaml
File format Select (None), YAML, JSON, or Binary (Base64) as the format of the GCS file.
BLOCK memos Make any comments about this BLOCK.
Results variable

Designate the variable that will store the contents of the GCS file. The format of the data referenced by the variable is as follows:

  "gcs_url": "...",
  "timestamp": ...,
  "content": ...

Name Explanation
"gcs_url" The GCS URL of the file.
"timestamp" The time the file was processed expressed in UNIX time.
"content" The file's contents.