Using RAG Architecture to query databases, export to Google Sheets, and visualize in Looker Studio.

With Wren AI, you can immediately ask business questions from any data source and import them to your Google Sheets to analyze and visualize Looker Studio in one click.

Howard Chi
Co-founder of Wren AI
Updated:
August 20, 2024
November 25, 2024
5
min read
Published:
July 30, 2024

In today’s data-driven world, data analysts, product managers, and business executives must have efficient tools for managing, analyzing, and visualizing data. Imagine being able to query databases using natural language and then export the results directly into Google Sheets.

Google Sheets has become a popular tool for business analysts to analyze their data, boasting over 900 million monthly users in 2024. With Wren AI’s latest integration, you can quickly query databases and seamlessly visualize data in Google Sheets. This blog post will walk you through using RAG architecture to query databases and export data to Google Sheets, helping you enhance your data management practices.

If you need guidance on using Wren AI to connect to your data sources using OpenAI API or hosting locally with Ollama, please check our previous articles below:

  1. How to use OpenAI GPT-4o to query your database?
  2. How to use Meta Llama 3 to query MySQL database using Ollama and Wren AI

What is Wren AI?

Before we start, if you are unfamiliar with Wren AI, you can check out GitHub first. Wren AI is an open-source text-to-SQL solution for data teams to get results and insights faster by asking business questions without writing SQL. Wren AI supports a wide range of data sources, such as DuckDB, MySQL, Microsoft SQL Server, BigQuery, etc… Also, she supports open and local LLM inference endpoints such as OpenAI GPT-3-turbo, GPT-4o, and local LLM hosts via Ollama.

Wren AI — Ask business questions and get answers from any sources.

Import data from Wren AI to Google Sheets

Using Wren AI to implement RAG on your database is very simple. First, select your database and fill in the connection information below.

Select your data source and fill in the connection information.

After setting the connection, you can select which table you want Wren AI to pull in the metadata; based on the table schema, you can add semantics via the UI interface, as shown below, on the modeling page.

Modeling your data in database

Selecting one of the models lets you modify the metadata and semantics.

Edit and update the semantics.

We will use the Wren AI demo site in this tutorial, which you can also check out here. In the Wren AI demo site, you can see several threads asked by previous users.

Ask your business questions on Wren AI.

Install “Wren AI for Google Sheets™” Add-on via Google Workspace Marketplace

Click “Extensions” in the toolbar, and select “Add-ons”, and then click “Get add-ons”.

Search for “Wren AI”, and you will see there is a search result for Wren AI, called “Wren AI for Google Sheets™”.

Click “Install” to start installing the Google Sheet add-in.

After the installation, you can see a new add-on in your extension dropdown! Click on the “Open Sidebar”.

And then you will see a Wren AI sidebar!

Connect to your Wren AI Server in the Add-on

Now let’s connect to our Wren AI server. In this tutorial, we will use our demo site as an example: https://demo.getwren.ai/home.

After clicking connect, I can choose whether to export from an answered result or a saved view.

I choose “Export data from an answered result” in this example, shown below.

Select one of the thread histories, and you can export it to Google Sheets.

Export datasets to Google Sheets

When I clicked into a thread, I could “Export it into the sheet”.

Click “Export to sheet,” and the data will be exported to your Google Sheets!

Creating reports on Looker Studio!

After loading data into Google Sheets, you can create a report on Looker Studio in one click to conduct further data analysis.

Hooray! Your Report is here!

And that’s about it!

Check out Wren AI GitHub (https://github.com/Canner/WrenAI) and start analyzing your data!

You can also check out our Google Sheet add-on document here.

If you are interested in Wren AI integration with Excel, check out our other post here.

Supercharge Your Data with AI Today?!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Join our newsletter to stay up to date on features and releases.
© 2024 Canner. All right reserved.