DEV Community

hayato onodera
hayato onodera

Posted on • Originally published at Medium on

3

How to Build a Data App with Google Sheets Backend Using Evidence

image0

In this article, we will introduce the process of building a data app with a spreadsheet backend using Evidence. We will also explore the use cases where Evidence is particularly well-suited.

In the previous article, we introduced multiple methods for building a data app with a spreadsheet backend. This time, we will focus on one of the code-based frameworks mentioned earlier, Evidence, providing a detailed introduction and step-by-step guide.

Here is the previous article:https://dev.to/morph-data/how-to-build-an-internal-data-application-using-google-sheets-as-a-data-source-ddo

What is Evidence?

Evidence is an open-source framework primarily built on SvelteKit, a JavaScript framework. It requires a Node.js environment to operate.

One of the key features of Evidence is that it allows users to build dashboard-like data applications using SQL and Markdown syntax. Unlike traditional BI tools, which require complex GUI operations, Evidence enables users to create and manage interactive dashboards entirely in a code-based manner.

Step-by-Step Guide

Google Cloud / Google Sheets Configuration

1. Enable the Google Sheets API

Log in to the Google Developers Console, create a new project, and enable the Google Sheets API.

2. Generate a Service Account and Download the JSON Key

Go to APIs & Services > Credentials and create a new service account. Under the Keys tab of the service account, create a new key and download it in JSON format.

3. Grant Access to the Service Account on the Target Spreadsheet

Click the Share button on the Google Spreadsheet and add the service account. This allows the service account to access the spreadsheet data.

Setting Up and Configuring Evidence

1.Install the Evidence framework and start the development server.

npx degit evidence-dev/template project-name
cd project-name
npm install
npm run sources
npm run dev
Enter fullscreen mode Exit fullscreen mode

2.Install the Google Sheets plugin by running:

npm install @evidence-dev/connector-gsheets
Enter fullscreen mode Exit fullscreen mode

3.After installation, add the following to the end of evidence.config.yaml:

"@evidence-dev/connector-gsheets": { }
Enter fullscreen mode Exit fullscreen mode

4.Run npm run dev to launch the Evidence page in the browser. Click on the "..." at the top and navigate to the Settings page.

image1

5.Click +New Sources. Select gsheets as the Source Type, enter a directory name, and click Next.

image2

6.Upload the JSON file obtained in step 2 of the Google Cloud / Google Sheets Configuration section by clicking Choose file. Once the upload is complete, click Test Configuration to verify the connection. If there are no issues, click Save to store the connection settings.

image3

7.Once the connection settings are saved, two files, connection.options.yml and connection.yml, will be generated in the directory created in step 5. Modify connection.yml as follows:

name: [your_source_name]
type: gsheets
options: {}
sheets:
[your_workbook_name]: [your_sheet_id]
Enter fullscreen mode Exit fullscreen mode

8.Create a new file named spreadsheet.md under the pages directory to build the app.

## Check data connection
``sql gsheets
select * from googlesheets.test_test
``

## Count group by date
``sql count_groupby_date
select "Created Date" as date , 
        count(*) as count 
from googlesheets.test_test
     group by "Created Date"
     order by "Created Date" DESC
``

## Dashboard
<Grid cols=2>
    <DataTable data={count_groupby_date}/>

    <LineChart 
        data = {count_groupby_date}    
        y = count 
        title = 'chart' 
    />
</Grid>
Enter fullscreen mode Exit fullscreen mode

9.Open the developed app in your browser to verify that everything is working correctly.

image4

Summary

Evidence is ideal for data teams that primarily work with SQL and need to build data apps for analysis and reporting tasks.

Use cases where Evidence excels include KPI tracking, sharing business metrics (such as financial reports, sales performance dashboards, and marketing analytics reports), and creating regularly updated dashboards managed by data analyst teams.

Traditionally, data aggregation (using SQL) and visualization (using GUI-based BI tools or Python) were separate processes. However, with Evidence, dashboards can be created and managed entirely with SQL, making it a powerful tool for the right use cases.

We encourage you to give it a try!


Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more