<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hayato Onodera on Medium]]></title>
        <description><![CDATA[Stories by Hayato Onodera on Medium]]></description>
        <link>https://medium.com/@hayato.onodera?source=rss-c061e9c2be82------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mC0frzjkrLhvY9ZbIiL-7g.jpeg</url>
            <title>Stories by Hayato Onodera on Medium</title>
            <link>https://medium.com/@hayato.onodera?source=rss-c061e9c2be82------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:24:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hayato.onodera/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Build a Internal Data App with Google Sheets Backend Using Streamlit]]></title>
            <link>https://medium.com/morph-tech-blog/how-to-build-a-internal-data-app-with-google-sheets-backend-using-streamlit-ee8c0157aad0?source=rss-c061e9c2be82------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee8c0157aad0</guid>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[google-sheets]]></category>
            <category><![CDATA[streamlit-app-deployment]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Hayato Onodera]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 07:20:49 GMT</pubDate>
            <atom:updated>2025-05-11T19:20:58.486Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YRNcr7TGCHVYXNGfHR2uRw.jpeg" /></figure><blockquote>In this article, we’ll walk you through the process of building an internal-use data app using Streamlit with a spreadsheet as the backend. We’ll also explore scenarios where Streamlit is a particularly good fit.</blockquote><p>In our <strong>previous article</strong>, we introduced several ways to build data apps using spreadsheets as the backend.</p><p>This time, we’ll dive deeper into one of the code-based frameworks we mentioned — <strong>Streamlit</strong> — and explain how to build a data app that’s suitable for internal operations.</p><p>You can check out the previous article here:<a href="https://medium.com/morph-tech-blog/how-to-build-an-internal-data-application-using-spreadsheets-as-a-data-source-8970b8641152">https://medium.com/morph-tech-blog/how-to-build-an-internal-data-application-using-spreadsheets-as-a-data-source-8970b8641152</a></p><h3>Step-by-Step Guide</h3><h3>Google Cloud / Google Sheets Configuration</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FU0I00Ycqcbc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DU0I00Ycqcbc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FU0I00Ycqcbc%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c5983a6f7d6c27932195ace2facb618/href">https://medium.com/media/3c5983a6f7d6c27932195ace2facb618/href</a></iframe><p><strong>1. Enable the Google Sheets API</strong>Log in to the Google Developers Console, create a new project, and enable the Google Sheets API.</p><p><strong>2. Generate a Service Account and Download the JSON Key</strong>Go to APIs &amp; Services &gt; 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.</p><p><strong>3. Grant Access to the Service Account on the Target Spreadsheet</strong>Click the Share button on the Google Spreadsheet and add the service account. This allows the service account to access the spreadsheet data.</p><h3>Setting Up and Building with Streamlit</h3><p>In this section, we’ll build a Streamlit app using the directory structure shown below.</p><pre>project-name/<br>│<br>├── app.py               <br>└── service_key.json    </pre><ol><li>Move to your project directory and install the Streamlit framework.</li></ol><pre>cd project-name<br>pip install streamlit</pre><p>2. Place the JSON file you obtained in Step-by-Step Guide<em> 2</em> as service_key.json.</p><p>3. Write your code in app.py to build the Streamlit application.</p><pre>import streamlit as st<br>from google.oauth2 import service_account<br>import gspread<br>import pandas as pd<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>from datetime import datetime<br><br><br># Add a title to the app<br>st.title(&#39;Dashboard&#39;)<br><br># Google Sheets Authentication<br>scopes = [ &#39;https://www.googleapis.com/auth/spreadsheets&#39;, &#39;https://www.googleapis.com/auth/drive&#39;<br>]<br>credentials = service_account.Credentials.from_service_account_file( &quot;./service_key.json&quot;, scopes=scopes<br>)<br>gc = gspread.authorize(credentials)<br><br># Get data from Google Sheets<br>SP_SHEET_KEY = &#39;{Sheet ID}&#39; # sheet id (which can be found in the URL of the Google Sheet, after https://docs.google.com/spreadsheets/d/)<br>sh = gc.open_by_key(SP_SHEET_KEY)<br>SP_SHEET = &#39;test&#39; # Sheet name<br>worksheet = sh.worksheet(SP_SHEET)<br>data = worksheet.get_all_values() # Get all data from the sheet<br>df = pd.DataFrame(data[1:], columns=data[0]) # Convert data to DataFrame<br><br># Display original DataFrame (limited to 100 rows with scrolling)<br>st.subheader(&#39;Original Data&#39;)<br>st.dataframe(df.head(100), height=400)  # height parameter adds scrolling capability<br><br># Check if &#39;Created Date&#39; column exists<br>if &#39;Created Date&#39; in df.columns:<br>    # Convert to datetime format (adjust format as needed)<br>    df[&#39;Created Date&#39;] = pd.to_datetime(df[&#39;Created Date&#39;])<br>    <br>    # Group by date and count records<br>    count_by_date = df.groupby(df[&#39;Created Date&#39;].dt.date).size().reset_index()<br>    count_by_date.columns = [&#39;Created Date&#39;, &#39;Count&#39;]<br>    <br>    # Sort by Created Date in descending order<br>    count_by_date = count_by_date.sort_values(&#39;Created Date&#39;, ascending=False)<br>    <br>    # Create two columns for side-by-side display<br>    st.subheader(&#39;Record Count by Date&#39;)<br>    col1, col2 = st.columns([3, 2])  # Adjust the ratio to make the first column wider<br>    <br>    # Display grouped DataFrame in the first column<br>    with col1:<br>        st.dataframe(count_by_date.head(100), height=400)<br>    <br>    # Create line chart in the second column<br>    with col2:<br>        # For the chart, we need to sort by date in ascending order<br>        chart_data = count_by_date.sort_values(&#39;Created Date&#39;, ascending=True)<br>        st.line_chart(chart_data.set_index(&#39;Created Date&#39;))<br>else:<br>    st.error(&quot;&#39;Created Date&#39; column not found in the DataFrame. Please check the column name.&quot;)<br>    st.write(&quot;Available columns:&quot;, df.columns.tolist())</pre><p>4. Open the app in your browser to verify that it works.</p><pre>streamlit run app.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KTMolx8VHx96ULsPy5jbIg.png" /></figure><h3>Adding Authentication for Internal Use</h3><p>When running Streamlit apps internally, authentication becomes essential.</p><p>Here, we’ll cover <strong>three methods</strong> for implementing authentication.</p><p>If you’re only deploying a single app, the first method might be sufficient.</p><p>However, if you have multiple apps or plan to scale in the future, we recommend using either the second or third approach.</p><h3>1. Add Authentication to Each App Individually</h3><p>As of version 1.42.0, Streamlit supports <strong>OpenID Connect (OIDC)</strong> for user authentication.You can use this built-in feature to add flexible authentication to your app.</p><ul><li><strong>Pros</strong>: Highly flexible authentication</li><li><strong>Cons</strong>: Requires implementation for each app, which increases development effort</li></ul><p>Official documentation: <a href="https://docs.streamlit.io/develop/concepts/connections/authentication">https://docs.streamlit.io/develop/concepts/connections/authentication</a></p><h3>2. Use Snowflake in Streamlit</h3><p>Snowflake in Streamlit allows you to build and host Streamlit apps directly on the Snowflake platform.Since authentication to Snowflake also applies to your Streamlit app, no additional authentication implementation is required.</p><ul><li><strong>Pros</strong>: No need to implement authentication individually for each app</li><li><strong>Cons</strong>: Requires a Snowflake account / Limited to fewer components compared to open-source Streamlit</li></ul><p>Official documentation: <a href="https://docs.snowflake.com/en/developer-guide/streamlit/about-streamlit">https://docs.snowflake.com/en/developer-guide/streamlit/about-streamlit</a></p><h3>3. Use Squadbase</h3><p>Squadbase is a cloud platform that supports Streamlit deployment.By deploying your Streamlit app to Squadbase, you can leverage Squadbase<strong> built-in authentication</strong>, eliminating the need to implement it manually.</p><ul><li><strong>Pros</strong>: No need for individual authentication implementation / Centralized app management</li><li><strong>Cons</strong>: Involves using an external service (Squadbase)</li></ul><p>Official documentation: <a href="https://www.squadbase.dev/en">https://www.squadbase.dev/en</a></p><h3>Conclusion</h3><p>Streamlit is a great tool for data scientists and analysts who are comfortable with Python and want to build data applications powered by machine learning or AI.</p><p>It’s especially well-suited for internal tools like:</p><ul><li>Workflow automation apps using LLMs</li><li>Demand forecasting tools</li><li>Internal chatbots that reference company documents</li></ul><p>There are endless ways to apply Streamlit — so we encourage you to give it a try!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee8c0157aad0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/morph-tech-blog/how-to-build-a-internal-data-app-with-google-sheets-backend-using-streamlit-ee8c0157aad0">How to Build a Internal Data App with Google Sheets Backend Using Streamlit</a> was originally published in <a href="https://medium.com/morph-tech-blog">Squadbase Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Data App with Google Sheets Backend Using Evidence]]></title>
            <link>https://medium.com/morph-tech-blog/how-to-build-a-data-app-with-google-sheets-backend-using-evidence-38e00f938365?source=rss-c061e9c2be82------2</link>
            <guid isPermaLink="false">https://medium.com/p/38e00f938365</guid>
            <category><![CDATA[markdown]]></category>
            <category><![CDATA[evidence]]></category>
            <category><![CDATA[google-sheets]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[dashboard]]></category>
            <dc:creator><![CDATA[Hayato Onodera]]></dc:creator>
            <pubDate>Tue, 18 Mar 2025 12:08:52 GMT</pubDate>
            <atom:updated>2025-03-18T12:08:52.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ln7_GGe3qLJM6lN5W1tKVA.jpeg" /></figure><blockquote>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.</blockquote><p>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.</p><p>Here is the previous article:<a href="https://medium.com/morph-tech-blog/how-to-build-an-internal-data-application-using-spreadsheets-as-a-data-source-8970b8641152">https://medium.com/morph-tech-blog/how-to-build-an-internal-data-application-using-spreadsheets-as-a-data-source-8970b8641152</a></p><h3>What is Evidence?</h3><p>Evidence is an open-source framework primarily built on SvelteKit, a JavaScript framework. It requires a Node.js environment to operate.</p><p>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.</p><h3>Step-by-Step Guide</h3><h3>Google Cloud / Google Sheets Configuration</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FU0I00Ycqcbc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DU0I00Ycqcbc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FU0I00Ycqcbc%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c5983a6f7d6c27932195ace2facb618/href">https://medium.com/media/3c5983a6f7d6c27932195ace2facb618/href</a></iframe><p><strong>1. Enable the Google Sheets API<br></strong>Log in to the Google Developers Console, create a new project, and enable the Google Sheets API.</p><p><strong>2. Generate a Service Account and Download the JSON Key<br></strong>Go to APIs &amp; Services &gt; Credentials and create a new service account.<br>Under the Keys tab of the service account, create a new key and download it in JSON format.</p><p><strong>3. Grant Access to the Service Account on the Target Spreadsheet<br></strong>Click the Share button on the Google Spreadsheet and add the service account. This allows the service account to access the spreadsheet data.</p><h3>Setting Up and Configuring Evidence</h3><ol><li>Install the Evidence framework and start the development server.</li></ol><pre>npx degit evidence-dev/template project-name<br>cd project-name<br>npm install<br>npm run sources<br>npm run dev</pre><p>2. Install the Google Sheets plugin by running:</p><pre>npm install @evidence-dev/connector-gsheets</pre><p>3. After installation, add the following to the end of evidence.config.yaml:</p><pre>&quot;@evidence-dev/connector-gsheets&quot;: { }</pre><p>4. Run npm run dev to launch the Evidence page in the browser. Click on the &quot;...&quot; at the top and navigate to the Settings page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6L2gKtzXGvehW9VN1V5EQ.png" /></figure><p>5. Click +New Sources. Select gsheets as the Source Type, enter a directory name, and click Next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yYQ8vxfcve7XOq2cunhDyA.png" /></figure><p>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.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q8i4NM-SKm4KUtJWUoVbDg.png" /></figure><p>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:</p><ul><li>your_workbook_name: The name of the Google Spreadsheet file</li><li>your_sheet_id: The Google Spreadsheet ID (the string after https://docs.google.com/spreadsheets/d/ in the URL)</li></ul><pre>name: [your_source_name]<br>type: gsheets<br>options: {}<br>sheets:<br>[your_workbook_name]: [your_sheet_id]</pre><p>8. Create a new file named spreadsheet.md under the pages directory to build the app.</p><pre>## Check data connection<br>```sql gsheets<br>select * from googlesheets.test_test<br>```<br><br>## Count group by date<br>```sql count_groupby_date<br>select &quot;Created Date&quot; as date , <br>        count(*) as count <br>from googlesheets.test_test<br>    group by &quot;Created Date&quot;<br>    order by &quot;Created Date&quot; DESC<br>```<br><br>## Dashboard<br>&lt;Grid cols=2&gt;<br>    &lt;DataTable data={count_groupby_date}/&gt;<br><br>    &lt;LineChart <br>        data = {count_groupby_date}    <br>        y = count <br>        title = &#39;chart&#39; <br>    /&gt;<br>&lt;/Grid&gt;</pre><p>9. Open the developed app in your browser to verify that everything is working correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGymVso9_PBnG2HlGBoVTw.png" /></figure><h3>Summary</h3><p>Evidence is ideal for <strong>data teams that primarily work with SQL and need to build data apps for analysis and reporting tasks</strong>.</p><p>Use cases where Evidence excels include KPI tracking, sharing business metrics (such as financial reports, sales performance dashboards, and marketing analytics reports), and <strong>creating regularly updated dashboards managed by data analyst teams</strong>.</p><p>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.</p><p>We encourage you to give it a try!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38e00f938365" width="1" height="1" alt=""><hr><p><a href="https://medium.com/morph-tech-blog/how-to-build-a-data-app-with-google-sheets-backend-using-evidence-38e00f938365">How to Build a Data App with Google Sheets Backend Using Evidence</a> was originally published in <a href="https://medium.com/morph-tech-blog">Squadbase Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build an Internal Data Application Using Google Sheets as a Data Source]]></title>
            <link>https://medium.com/morph-tech-blog/how-to-build-an-internal-data-application-using-spreadsheets-as-a-data-source-8970b8641152?source=rss-c061e9c2be82------2</link>
            <guid isPermaLink="false">https://medium.com/p/8970b8641152</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[evidence]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[spreadsheets]]></category>
            <dc:creator><![CDATA[Hayato Onodera]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 17:25:35 GMT</pubDate>
            <atom:updated>2025-03-13T17:31:45.431Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VQ5R9Y7zcJmI5rKP7AW95Q.jpeg" /></figure><blockquote>This article introduces multiple approaches to building an internal data application using google sheets as the backend. In addition to summarizing the advantages and disadvantages of each approach, we will also discuss the differences from the perspective of AI functionality, which has been gaining increasing demand.</blockquote><p>Many teams manage their daily data using Google Sheets due to its high convenience. But when you decide to build a data application using google sheets as the backend, what are your options?</p><h3>Code-Based / Low-Code / No-Code</h3><p>The methods for building an internal data application can be categorized into three approaches: code-based development, low-code tools, and no-code tools. Below are the descriptions and representative tools for each approach.</p><h3>Code-Based</h3><p>This approach involves building a data application with code. While it requires coding, the frameworks introduced below provide pre-built components that enable rapid development. Additionally, since they are open-source, you can choose your deployment environment.</p><p><strong>[Representative Tools]</strong></p><ul><li>Streamlit: <a href="https://streamlit.io/">https://streamlit.io/</a></li><li>Evidence: <a href="https://evidence.dev/">https://evidence.dev/</a></li><li>Morph: <a href="https://www.morph-data.io/ja">https://www.morph-data.io/</a></li></ul><h3>Low-Code</h3><p>This approach combines coding and GUI-based development. For simple applications with minimal functionality/UI, it is possible to build using only the GUI, while some parts can be customized with code. Compared to no-code, low-code allows for more flexibility, but it still has limitations compared to full code-based development.</p><p><strong>[Representative Tools]</strong></p><ul><li>Appsmith: <a href="https://www.appsmith.com/">https://www.appsmith.com/</a></li><li>Retool: <a href="https://retool.com/">https://retool.com/</a></li><li>OutSystems：<a href="https://www.outsystems.com/?sc_lang=en">https://www.outsystems.com/?sc_lang=en</a></li></ul><h3>No-Code</h3><p>This approach allows users to build data applications entirely through GUI-based tools, making it accessible to non-engineers. However, it has significant limitations in terms of handling complex processing and UI customization. Additionally, the development skill is heavily dependent on familiarity with the specific tool, making knowledge transfer a challenge.</p><p><strong>[Representative Tools]</strong></p><ul><li>AppSheet: <a href="https://about.appsheet.com/home/">https://about.appsheet.com/home/</a></li><li>Glide: <a href="https://www.glideapps.com/">https://www.glideapps.com/</a></li><li>Softr: <a href="https://www.softr.io/">https://www.softr.io/</a></li></ul><h3>Compatibility with AI Features</h3><p>One of the most significant emerging needs is AI integration. Let’s examine how well each category supports AI functionality.</p><h3>Code-Based</h3><p>With a code-based approach, you can leverage open-source AI frameworks such as Langchain and CrewAI, allowing for the highest level of flexibility in AI development. This approach supports model switching, fine-tuning with custom datasets, and other advanced AI functionalities. Since internal business workflows vary widely between companies and often involve complex logic, this approach is <strong>the most recommended for building AI-powered applications tailored to your business needs</strong>.</p><h3>Low-Code</h3><p>In general, AI functionality in low-code platforms relies on pre-integrated external APIs. While parameters and prompts can be tuned, you cannot perform additional training with new datasets or freely select AI models. This makes low-code a suitable choice for single-task AI use cases but limits its flexibility. Therefore, the AI compatibility of low-code is considered <strong>moderate</strong>.</p><h3>No-Code</h3><p>With a no-code approach, you can only use the AI features provided by the platform. While these features are easy to use, they lack customization options, making them useful only for specific use cases. No-code is ideal for Proof of Concept (PoC) and quick experiments, but for building production-ready applications, <strong>AI compatibility is low</strong>.</p><h3>Comparison of Code-Based Frameworks</h3><p>Next, let’s focus on code-based frameworks and try building a simple application using google sheets as the backend. For this example, we will create a dashboard to manage user inquiry data stored in a spreadsheet.</p><h3>Streamlit</h3><p>First, we will build the application with Streamlit. Streamlit allows you to complete the development using a single Python file.</p><pre>import streamlit as st<br>from google.oauth2 import service_account<br>import gspread<br>import pandas as pd<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>from datetime import datetime<br># Add a title to the app<br>st.title(&#39;Dashboard&#39;)<br># Google Sheets Authentication<br>scopes = [ &#39;https://www.googleapis.com/auth/spreadsheets&#39;, &#39;https://www.googleapis.com/auth/drive&#39;<br>]<br>json_file_path = os.path.join(os.path.dirname(__file__), &quot;../credential.json&quot;)<br>credentials = service_account.Credentials.from_service_account_file(json_file_path, scopes=scopes)<br>gc = gspread.authorize(credentials)<br># Get data from Google Sheets<br>SP_SHEET_KEY = &#39;{Sheet ID}&#39; # sheet id (which can be found in the URL of the Google Sheet, after https://docs.google.com/spreadsheets/d/)<br>sh = gc.open_by_key(SP_SHEET_KEY)<br>SP_SHEET = &#39;test&#39; # Sheet name<br>worksheet = sh.worksheet(SP_SHEET)<br>data = worksheet.get_all_values() # Get all data from the sheet<br>df = pd.DataFrame(data[1:], columns=data[0]) # Convert data to DataFrame<br># Display original DataFrame (limited to 100 rows with scrolling)<br>st.subheader(&#39;Original Data&#39;)<br>st.dataframe(df.head(100), height=400) # height parameter adds scrolling capability<br># Check if &#39;Created Date&#39; column exists<br>if &#39;Created Date&#39; in df.columns:<br> # Convert to datetime format (adjust format as needed)<br> df[&#39;Created Date&#39;] = pd.to_datetime(df[&#39;Created Date&#39;])<br> <br> # Group by date and count records<br> count_by_date = df.groupby(df[&#39;Created Date&#39;].dt.date).size().reset_index()<br> count_by_date.columns = [&#39;Created Date&#39;, &#39;Count&#39;]<br> <br> # Sort by Created Date in descending order<br> count_by_date = count_by_date.sort_values(&#39;Created Date&#39;, ascending=False)<br> <br> # Create two columns for side-by-side display<br> st.subheader(&#39;Record Count by Date&#39;)<br> col1, col2 = st.columns([3, 2]) # Adjust the ratio to make the first column wider<br> <br> # Display grouped DataFrame in the first column<br> with col1:<br> st.dataframe(count_by_date.head(100), height=400)<br> <br> # Create line chart in the second column<br> with col2:<br> # For the chart, we need to sort by date in ascending order<br> chart_data = count_by_date.sort_values(&#39;Created Date&#39;, ascending=True)<br> st.line_chart(chart_data.set_index(&#39;Created Date&#39;))<br>else:<br> st.error(&quot;&#39;Created Date&#39; column not found in the DataFrame. Please check the column name.&quot;)<br> st.write(&quot;Available columns:&quot;, df.columns.tolist())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KTMolx8VHx96ULsPy5jbIg.png" /></figure><h3>Evidence</h3><p>Next, let’s try Evidence. Evidence is built with the SvelteKit JavaScript framework, so you need a Node.js environment to use it.</p><pre>## Check data connection<br>```sql gsheets<br>select * from googlesheets.test_test<br>```<br><br>## Count group by date<br>```sql count_groupby_date<br>select &quot;Created Date&quot; as date , <br>        count(*) as count <br>from googlesheets.test_test<br>    group by &quot;Created Date&quot;<br>    order by &quot;Created Date&quot; DESC<br>```<br><br>## Dashboard<br>&lt;Grid cols=2&gt;<br>    &lt;DataTable data={count_groupby_date}/&gt;<br><br>    &lt;LineChart <br>        data = {count_groupby_date}    <br>        y = count <br>        title = &#39;chart&#39; <br>    /&gt;<br>&lt;/Grid&gt;</pre><p>The app will look like this. One nice touch is that the SQL source code is displayed alongside it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGymVso9_PBnG2HlGBoVTw.png" /></figure><h3>Morph</h3><p>Finally, we will use the Morph framework. Morph is unique in that it allows you to structure your application using separate Python and Markdown files. Additionally, Python functions are written in a standard function format, making it easier to learn.</p><pre># Get spreadsheet data<br><br>import pandas as pd<br>import gspread<br>from oauth2client.service_account import ServiceAccountCredentials<br>import os<br>import morph<br>from morph import MorphGlobalContext<br>@morph.func<br>def get_gsheets(context: MorphGlobalContext):<br>    # Configure authentication information<br>    json_path = os.path.join(os.path.dirname(__file__), &quot;../credential.json&quot;)<br>    scope = [&#39;https://spreadsheets.google.com/feeds&#39;, &#39;https://www.googleapis.com/auth/drive&#39;]<br>    # get certification information<br>    credentials = ServiceAccountCredentials.from_json_keyfile_name(json_path, scope)<br>    client = gspread.authorize(credentials)<br>    # Open Spreadsheet<br>    spreadsheet = client.open_by_key(&quot;Sheet ID&quot;)<br>    worksheet = spreadsheet.worksheet(&quot;Sheet name&quot;)<br>    # Get data and convert to a DataFrame<br>    data = worksheet.get_all_values()<br>    df = pd.DataFrame(data[1:], columns=data[0])<br>    return df</pre><pre>## Display of aggregated table<br><br>import pandas as pd<br>import morph<br>from morph import MorphGlobalContext<br>@morph.func()<br>@morph.load_data(&quot;get_gsheets&quot;)<br>def group_by_date(context: MorphGlobalContext):<br>    df = context.data[&quot;get_gsheets&quot;]<br>    # Group by Created Date and count records, then sort by date in descending order<br>    grouped_df = df.groupby(&#39;Created Date&#39;).size().reset_index(name=&#39;count&#39;)<br>    grouped_df = grouped_df.sort_values(&#39;Created Date&#39;, ascending=False)<br>    return grouped_df</pre><pre># Display of Chart<br><br>import plotly.express as px<br>import pandas as pd<br>import morph<br>from morph import MorphGlobalContext<br>@morph.func()<br>@morph.load_data(&quot;group_by_date&quot;)<br>def group_by_date_chart(context: MorphGlobalContext):<br>    df = context.data[&quot;group_by_date&quot;]<br>    df[&#39;Created Date&#39;] = pd.to_datetime(df[&#39;Created Date&#39;])<br>    df[&#39;count&#39;] = pd.to_numeric(df[&#39;count&#39;], errors=&#39;coerce&#39;)<br>    # Create a line chart using plotly<br>    fig = px.line(df, x=&#39;Created Date&#39;, y=&#39;count&#39;, title=&#39;Record Count by Created Date&#39;)<br>    return fig.to_html()</pre><pre>{/* Frontend */}<br>## Dashboard<br>&lt;DataTable<br>  loadData=&quot;get_gsheets&quot;<br>  height={300}<br> /&gt;<br>&lt;Grid cols=&quot;2&quot;&gt;<br>    &lt;div&gt;<br>        ## Table<br>        &lt;DataTable<br>            loadData=&quot;group_by_date&quot;<br>            height={300}<br>        /&gt;<br>    &lt;/div&gt;<br>    &lt;div&gt;<br>        ## Chart<br>        &lt;Embed<br>            loadData=&quot;group_by_date_chart&quot;<br>            height={300}<br>            width={800}<br>        /&gt;<br>    &lt;/div&gt;<br>&lt;/Grid&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ahEho0eM7KWKgBb174s8pg.png" /></figure><h3>Summary of Comparisons</h3><p>If you are familiar with Python, <strong>Streamlit and Morph</strong> will feel the most intuitive. If you are a data analyst proficient in SQL but not experienced with Python, you might prefer <strong>Evidence</strong>.</p><p>For dashboard applications, <strong>Evidence</strong> is a strong option because it provides many pre-built chart components, reducing the amount of code needed. If you need additional AI functionalities or features beyond dashboards, <strong>Streamlit or Morph</strong> would be better choices.</p><p>If you want maximum flexibility in UI customization, <strong>Morph</strong> stands out because it allows you to create custom React components and apply styling flexibly using MDX files.</p><h3>Pros, Cons, and Recommended Use Cases</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUkdRBoCwszGfwPxlT2sPA.png" /></figure><h3>Conclusion</h3><p>When comparing no-code, low-code, and code-based approaches for developing data applications with google sheets as the backend, there is a trade-off between flexibility, speed, and engineering requirements. For simple single-function applications or PoC use cases, no-code and low-code are viable options due to their speed. However, for building <strong>enterprise-grade internal data applications that meet specific operational needs, code-based approaches are more advantageous</strong>.</p><p>Considering the increasing demand for AI integration, <strong>Python frameworks such as Streamlit and Morph are strong contenders</strong> for future-proof data applications. Give them a try and see which one fits your needs!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8970b8641152" width="1" height="1" alt=""><hr><p><a href="https://medium.com/morph-tech-blog/how-to-build-an-internal-data-application-using-spreadsheets-as-a-data-source-8970b8641152">How to Build an Internal Data Application Using Google Sheets as a Data Source</a> was originally published in <a href="https://medium.com/morph-tech-blog">Squadbase Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Dashboard Web App Using Google Sheets and Markdown]]></title>
            <link>https://medium.com/morph-tech-blog/building-a-dashboard-web-app-using-google-sheets-and-markdown-91051eccacdf?source=rss-c061e9c2be82------2</link>
            <guid isPermaLink="false">https://medium.com/p/91051eccacdf</guid>
            <category><![CDATA[webapplicationdevelopment]]></category>
            <category><![CDATA[spreadsheets]]></category>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Hayato Onodera]]></dc:creator>
            <pubDate>Tue, 18 Feb 2025 07:53:35 GMT</pubDate>
            <atom:updated>2025-05-11T19:17:52.533Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZmklziDTDZUbYV-ZNGgBGw.jpeg" /></figure><p>Spreadsheets are familiar and flexible. In addition to the ease of inputting, processing, and visualizing data, modern spreadsheets also offer features such as real-time collaborative editing. These advantages make them a popular foundation for managing and analyzing massive amounts of data in many environments the world over.</p><p>But how to integrate them into a modern workflow? In this article, we focus on these spreadsheet utilities and explain the detailed process of converting them into a practical dashboard web app using the Morph framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bHjtlQHO43fjMxbiXwX2eQ.png" /></figure><p>The app built in this tutorial is shown below:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFG00NTMcFlE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFG00NTMcFlE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFG00NTMcFlE%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8691ec7dccfd998f2c511835a57ce6a/href">https://medium.com/media/d8691ec7dccfd998f2c511835a57ce6a/href</a></iframe><p>Morph is a OSS for building web applications in Python and markdown.<br>repository: <a href="https://github.com/morph-data">https://github.com/morph-data</a></p><h3>Setting Up the Google Sheets API</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FU0I00Ycqcbc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DU0I00Ycqcbc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FU0I00Ycqcbc%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c5983a6f7d6c27932195ace2facb618/href">https://medium.com/media/3c5983a6f7d6c27932195ace2facb618/href</a></iframe><h4>1. Enable the Google Sheets API</h4><p>Log in to the Google Developers Console, create a new project, and enable the Google Sheets API.</p><h4>2. Create a Service Account and Download the JSON File</h4><p>Navigate to <strong>API &amp; Services &gt; Credentials</strong> and create a new service account.<br>Then, under the service account’s <strong>Keys</strong> tab, create a new key and download it in JSON format.</p><h4>3. Invite the Service Account to the Target Spreadsheet</h4><p>From the spreadsheet’s <strong>Share</strong> button, add the service account. This will allow the service account to access the data in that spreadsheet.</p><h3>Initializing the Project</h3><p>We will use Morph as the application framework. To use Morph, you must have Python 3.9 or later and Node.js 18 or later installed.<br>For detailed setup instructions, please refer to the documentation.</p><h4>Installing the Package</h4><pre>pip install morph-data</pre><h4>Initializing the Project</h4><pre>morph new sheet-app</pre><h4>Installing Additional Packages</h4><pre>pip install gspread oauth2client</pre><h3>Calling the Google Sheets API from Python</h3><h4>1. Converting Spreadsheet Data to a DataFrame</h4><pre>import pandas as pd<br>import gspread<br>from oauth2client.service_account import ServiceAccountCredentials<br>import os<br>import morph<br>from morph import MorphGlobalContext<br><br># Load authentication credentials and set them in the environment variables<br>auth = os.path.join(os.path.dirname(__file__), &quot;../credential.json&quot;)<br>os.environ[&#39;GOOGLE_APPLICATION_CREDENTIALS&#39;] = auth<br><br># Set the required scopes<br>scope = [&#39;https://spreadsheets.google.com/feeds&#39;]<br><br># Initialize the API client<br>credentials = ServiceAccountCredentials.from_json_keyfile_name(auth, scope)<br>client = gspread.authorize(credentials)<br><br>@morph.func<br>def get_sales_from_sheet(context: MorphGlobalContext):<br>    spread_sheet = client.open_by_key(&quot;SHEET_ID&quot;)  # Retrieve the entire spreadsheet<br>    raw_data = spread_sheet.worksheet(&quot;SHEET_NAME&quot;)  # Get the specific worksheet<br>    all_data = raw_data.get_all_values()<br>    # Convert to a DataFrame.<br>    df = pd.DataFrame(all_data[1:], columns=all_data[0])<br>    return df</pre><h4>2. Creating a Chart with Plotly from the DataFrame</h4><pre>import plotly.express as px<br>import pandas as pd<br>import morph<br>from morph import MorphGlobalContext<br><br>@morph.func<br>@morph.load_data(&quot;get_sales_from_sheet&quot;)  # Load the result from the specified function<br>def sales_chart(context: MorphGlobalContext):<br>    # Retrieve the result from get_sales_from_sheet<br>    df = context.data[&quot;get_sales_from_sheet&quot;]<br>    # Convert the &#39;Total_Sales&#39; column to numeric<br>    df[&#39;Total_Sales&#39;] = pd.to_numeric(df[&#39;Total_Sales&#39;], errors=&#39;coerce&#39;)<br>    # Aggregate the data<br>    df = context.data[&quot;get_sales_spreadsheet&quot;].groupby(&quot;Product&quot;).sum([&quot;Total_Sales&quot;]).reset_index()<br>    # Create the chart<br>    fig = px.bar(df, x=&quot;Product&quot;, y=&quot;Total_Sales&quot;)<br>    return fig</pre><p>One of the key features of Morph is that by using the @morph.load_data annotation, you can load results from other functions. What’s the difference from simply calling a Python function? With Morph, you can handle other file formats — such as SQL and Markdown — using the same mechanism.</p><h4>3. Building the UI</h4><pre># Sales Analysis Cheat Sheet<br><br>&lt;Grid cols=&quot;2&quot;&gt;&lt;div&gt;    <br>    ## Table Display<br>    &lt;DataTable loadData=&quot;get_sales_spreadsheet&quot; height={300} /&gt;<br>  &lt;/div&gt;<br><br>  &lt;div&gt;<br>    ## Chart Display<br>    &lt;Embed loadData=&quot;chart_sales_data&quot; height={300} /&gt;<br>  &lt;/div&gt;<br>&lt;/Grid&gt;</pre><h3>Deploying to Squadbase</h3><p>If you want to publish your locally built application to the web, you can deploy it to Squadbase instead of self-hosting. For more details, please refer to the documentation below.</p><p>Documentation: <a href="https://www.squadbase.dev/en/docs">https://www.squadbase.dev/en/docs</a></p><p>By following these steps, you can successfully publish a web dashboard that visualizes your spreadsheet data. The dashboard reflects real-time changes to the spreadsheet without risking accidental modifications to the original data, allowing you to share the dashboard safely. Give it a try!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91051eccacdf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/morph-tech-blog/building-a-dashboard-web-app-using-google-sheets-and-markdown-91051eccacdf">Building a Dashboard Web App Using Google Sheets and Markdown</a> was originally published in <a href="https://medium.com/morph-tech-blog">Squadbase Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>