Importdata on Google Sheets giving #N/A

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.

1 Like

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.


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

1 Like

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

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

Does that work for you?

1 Like

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)