ODBC connection excel VBA to Snowflake connection string needed

Need to connect excel VBA to snowflake. Can anyone provide a connection string for that?

2 answers

There is no ADO connection string for Snowflake. You have to access it via ODBC Data Source.

[ODBC]
driver={SnowflakeDSIIDriver}
server=
database=
schema=
warehouse=
role=
Uid=
Pwd=

You will need to go to the following link to install the most recent Snowflake drivers.
https://sfc-repo.snowflakecomputing.com/odbc/index.html

Here is what worked for me, as a connection string that used an ODBC DSN to Snowflake. "dsn=My_DSN_Name;uid=My_UserID" . It was easier for me to test in Powershell, as I found a code sample and PowerShell was on the server I was testing on. An interesting thing is that it didn't work unless I supplied the UserId, even though the UserId is already defined inside the DSN.
You could

#Updated from the Qliq site's PowerShell testing template
Get-Date
$dnsName= "My_DSN_name"
$user="My_User_ID"
$password=""
$csvPath= "C:\temp\OutFileNameForTestingTheDSN.csv"
#$sqlQuery= "select 2 as f1-- * from DB.dbo.Table"  #hardcode some SQL
$sqlQuery= Get-Content "C:\temp\TestSQL.txt"

$conn = New-Object Data.Odbc.OdbcConnection
$conn.ConnectionString= "dsn=$dnsName;uid=$user;pwd=$password;"
$conn.open()
$command =$conn.CreateCommand();
$command.CommandText=$sqlQuery

$dataAdapter = New-Object System.Data.Odbc.OdbcDataAdapter $command

$dataTable = new-object "System.Data.DataTable"
$dataAdapter.Fill($dataTable)
$conn.close()

$dataTable | Export-csv -Path $csvPath -NoTypeInformation
Get-Date