Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

How to get difference between two dates with Apache Superset connected to Google Sheets?

$
0
0

I'm using Apache Superset to visualise data. As one of the inputs I have a Google Sheets. I can display the values directly stored in the table, but I am unable to calculate a difference between two dates.

Let's say I have a table:

ABC
dateStarteddateFinishedcalculatedDiff
11-Jan-202215-Jan-202214

If I just calculate the difference between the columns in Google Sheets, I get the correct answer, which is 14 days. But I don't want to have these calculation columns in Google Sheets, I would like to do the calculations on the fly with Superset.

In Superset I try to run a query:

SELECT dateStarted, dateFinished, dateFinished-dateStartedFROM "https://docs.google.com/spreadsheets/d/*******"

I get:

dateStarteddateFinisheddateFinished-dateStarted
11-Jan-202215-Jan-20220

Which is not correct, I would expect to get 14.

Things I already tried:

  • I checked and Superset recognizes dateStarted and dateFinished as DATETIME type
  • If I sum the dates I get 4044, which implies only the year is considered
  • If I compare the dates it compares them correctly (not just by year)
  • datediff(dateFinished, dateStarted) doesn't work, I get an error

gsheets error: SQLError: no such function: datediff

I was looking for documentation specifically for Superset + Google Sheets integration, but couldn't find anything useful.

Any help will be much appreciated.


Viewing all articles
Browse latest Browse all 9782

Trending Articles