Importdata on Google Sheets giving #N/A


#1

When I use IMPORTDATA command on google sheets and provide a publicly shared Metabase question csv link as a parameter, the result is #N/A. I have passed the login, password for authentication in the URL as well.

Please help.


#2

No worries, I found the answer. We have a basic authentication set up for Metabase, so I just had to write a Google Apps script to go around it.


#3

Hi Sudeep, can you share more details of how you solved it please? I think I might be facing the same issue. I’m getting “Could not fetch url” when using importdata on metabase public csv link


#4

@sudeep I’d love to set this up if you’re able to share the auth script you used. Thx!


#5

A google for google+apps+script+basic+authorization spits out:

And then on top if google apps script is new to you (as it is to me) … the links in https://stackoverflow.com/tags/google-apps-script/info

Does that work for you?


#6

Thanks for your solutions but I already figured it out myself.

All I did was pass the basic auth credentials in the get call:

var resp = UrlFetchApp.fetch(csvUrl, {
headers: {
// use basic auth
‘Authorization’: 'Basic ’ + Utilities.base64Encode(
user + ‘:’ + pw, Utilities.Charset.UTF_8)
}
});