Coder Social home page Coder Social logo

metabase-google-sheets-add-on's Introduction

Metabase Google Sheets Add-on

This Google Sheets add-on imports the result of a Metabase question to a Google Sheet by using the Metabase API.

It has two main functions that an user can access:

  • importQuestion: import a single question from Metabase using it's question id number (you can find this at the end of a question URL) into the current Google Sheet tab
  • importAllQuestions: imports all questions in a Google Sheet using the following name convention: (metabase/123) -> imports question number 123

What Users See

This gif shows what users see in the add-on interface

Metabase API Access

Currently, the add-on authenticates with Metabase by using a user account. You can use your own user account or create a dedicated one for the add-on. It sends the username and password and gets a token in response that it uses to make requests. If the token is expired (after a certain period of time it will expire) then the script requests a new token.

When deploying for the first time, remember to set following ENV vars in your Google Script Project file, by going to File -> Project Properties:

  • BASE_URL (the url to your metabase instance with a trailing slash, e.g. https://my-company.metabase.com/)
  • USERNAME (a Metabase username)
  • PASSWORD (a Metabase user password)
  • TOKEN (do not set it; it will be set automatically)

Publishing the Add-on

Publishing a Google Apps Add-on is a tricky process. For help on how to publish a Google Sheets Add-on: https://developers.google.com/gsuite/add-ons/how-tos/publishing-editor-addons.

Otherwise, you can just use the code as a simple Google Apps Script. Remember, to access the Project Properties, you might have to switch to the old (legacy) Google Apps Script editor.

metabase-google-sheets-add-on's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metabase-google-sheets-add-on's Issues

Add on not available anymore?

It seems the add-on is no longer available through Google, so are you able to update your Readme to give more detail on how to set this up as a Google Apps script?

Addressing the metabase from internal server

I will appreciate it if someone helps me on running this addon for Metabase internal server. When I call all questions for the URL which I Provided, it showed me "Couldn't find any question numbers to import". It seems it can not query that link.

Auto import specific question instead of all questions

Hi @bplmp
I am wondering if it is possible to auto importing a specific question instead of all questions.
I added triggers in the Script based on time, but I have three different questions to update regularly. The issue is that they are too large to properly update all in one go. The script times out.
I am looking for a function to add a specific question, but pre-populated in the function already so I don't need to confirm the question number like with the importQuestion function.
Your help would be awesome!
Thank you!

Metabase Google Auth Login

This is a great script! How would we setup the script to login to our Metabase account if we use Google authorization for login?

Filter by column

Hi! I was wondering if there was any way to implement your code by providing a filter for the query, for example, import only the data from the querry corrresponding to a certain user_id.
Like n the image attached, filter by external_request_id.
Thanks!
image

Error popup

Hi, The code was perfect. The problem was when I run the code (Metabase, Import question) The below error is coming everytime

Exception: Request failed for https://insights.censanext.com returned code 401. Truncated server response: {"errors":{"password":"did not match stored password"}} (use muteHttpExceptions option to examine full response)

Please help

DNS Error

Hi @bplmp! This is wonderful!

I have set up my variables in Script Properties (legacy editor), but am still getting a DNS error of: Exception: DNS error: http://nullapi/session. This makes me think for some reason it isn't referencing the properties I've set up. Any thoughts?

Thanks!

Possibility to add variables

Hello all, I was wondering if there is a possibility to add variables to this script? my questions usually depend on a id number that I have as a variable, I tried to hard-code like

function getQuestionAndFillSheet(baseUrl, token, metabaseQuestionNum, sheetName) { var questionUrl = baseUrl + "api/card/" + metabaseQuestionNum + "?id=1193" + "/query/csv";

but it throws an error saying that the end point does not exist :(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.