Error with redash to googlesheets import function

Hi! I am getting all data from redash imported into googsheets directly through the API Key > Results in CSV format: using the IMPORTDATA function.

While it worked for the time - it has started error and never worked second iteration onwards. Throws the “Resource at url not found” error - snapshot below

image

Could an expert in this group help me navigate or in point where there is an issue and how to fix it ?

Thank you

Does the query use parameters by chance?

That’s correct! They they do have parameters

I see! You can’t use IMPORTDATA with queries that use parameters. Because the Redash API doesn’t allow you to GET results for parameterized queries. You need at least a POST request. IMPORTDATA only sends GET requests so they won’t work together.

It will work again if you remove the parameter from your query.

1 Like

@vikid @k4s1m Does anyone has some sample code for me to refer to? I bumped into the same problem, my query (developed by another Developer) has the parameter. I’m just a Finance User, could someone share the sample of POST request?
Thanks in advance

The documentation describes it pretty well: https://redash.io/help/user-guide/integrations-and-api/api

You post to api/queries/<query id>/results with a parameters object in your request body. The docs are written for a developer though so it might be outside the scope for a typical finance user.

while using importdata(), g-sheets asks to add 1000+ columns irrespective of my actual data result on Redash. Any suggestions?

Tried increasing columns but now it shows HTML code on the google sheet. Can any help with this?

image

This screenshot looks like something was messed up with your redash import URL. Because it’s pulling the HTML from a login screen.

Regarding your question in general: it’s hard to say without more information. I’m not able to reproduce this. When I use IMPORTDATA with a 3 column result set, only 3 columns are added to my g sheet.