Google Cloud Storage#

Getting Started#

To use Google Cloud Storage as a data source, you will need to install the google-cloud-storage Python package. You can install this package using pip:

pip install google-cloud-storage


Service Account Key File#

To authenticate with Google Cloud Storage, you will need to create a service account and download the service account key file. You can create a service account and download the key file by following the instructions here.

Once you have downloaded the key file, you can authenticate with Google Cloud Storage by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of the key file:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key/file.json

Reading Data#

To read data from Google Cloud Storage, you will need to create a StorageClient object. You can then use this object to read data from Google Cloud Storage.

# Cell 1 - Load libraries
import marimo as mo
from import storage

# Cell 2 - Load buckets
client = storage.Client()
buckets = client.list_buckets()

# Cell 3 - Select bucket
selected_bucket = mo.ui.dropdown(
    label="Select bucket", options=[ for b in buckets]

# Cell 4 - Load files
files = list(bucket.list_blobs())
items = [
        "Updated": f.updated.strftime("%h %d, %Y"),
        "Size": f.size,
    for f in files
file_table = mo.ui.table(items, selection="single")
file_table if items else"No files found").callout()


Check out our full example using Google Cloud Storage here

Or run it yourself:

marimo run