Queries for GoogleSpreadsheet:


#1

I want to use Google Spread Sheets as data source in Redash, I followed the instructions available on Redash Website to create service account and JSON file, I’m able to make successful connection.

But now, when I’m trying to write query, it gives an error " spread sheet not found, see below screen shot.

This is my Google Sheet link:
https://docs.google.com/spreadsheets/d/1w4ZYa5KBWPzZ-Zy5dxIRv-6QQTra7rEKT1WnUcJu5SE/pubhtml

and I’m using UID: 1w4ZYa5KBWPzZ-Zy5dxIRv-6QQTra7rEKT1WnUcJu5SE as what format is mentioned on Redash help center.

Can you please let me know what wrong I’m doing here?


#2

Did you share the spreadsheet with the email address of the service account you created?


#3

Yes Arik, spreadsheet is already shared.
let me know if you need any additional information.

Thank you,


#4

What address did you share it with? (you can send in a PM if you prefer)


#5

I have sent the details to you on personal email.


#6

For anyone following: the issue was that the document wasn’t shared with the service account email address. You need to use the service account email address, which is shown in the Google Console Dashboard or the JSON file and not the email address of your Google account.


#7

Hello arikfr,
I had the same problem.
I follow these instructions: https://redash.io/help/queries/query-google-spreadsheets.html2 for creating a Google Spreadsheet data source.
I created a service account and used that JSON file in the connection. I have already shared the spreadsheet with the service account email address (from the JSON file) - “client_email”: "myredash@my-redash-project-198828.iam.gserviceaccount.com".

Please write an example of the request to the page.
When I write select * from 1ujcotU-KwofBqdbrKyRq1xXyk46HwgEHpfnbR1qd25g
I get the error Error running query: Spreadsheet (select * from 1ujcotU-KwofBqdbrKyRq1xXyk46HwgEHpfnbR1qd25g) not found. Make sure you used correct id.

How to write a query correctly?

Thank you


#8

@Zezev

Unfortunately that’s not how you using spreadsheet as a datasource.
In your case, you should use
1ujcotU-KwofBqdbrKyRq1xXyk46HwgEHpfnbR1qd25g|0
as query.

Please see here.
https://help.redash.io/article/114-querying-a-google-spreadsheet