If you’ve followed Creating your own scriptDB environment we are ready to start accessing it from VBA.

Registering authentication

There are 2 things you need to do, both of which are one off things. You may have done this in the previous section
  • Register this PC for oAuth2. If you have already done this to “drive” scope with some other things on this site, as described in Google Oauth2 VBA authentication you wont need to bother doing that again.
  • Register this PC for your scriptDB environment.
Substitute your your google credentials, lets do everything at once, authorizing google, full access to the dbTest enviroment and dbProduction environment.
You’ll get something like this pop up – this will allow this PC to access your dbHandler webApp

You can now delete this function (or keep a copy in another workbook), since you wont need it again unless you change PC.

Adding some data to your test environment

Before that, first let’s check we have a connection, and that you have no data in either of your scriptDB.

Now we can add data from the 2 test data sheets in cDataSet.xlsm

More Tests

Why not go back to Getting started with cScriptDbCom and run the query tests, this time using dbTest as your authentication entry. You should get the same results as you did with my primer database.

Populating dbProduction.

We could simply repeat by populating dbProduction from the sheets as we did with dbTest. However, in real life, there might not be any sheets involved. Here’s how to copy a class from one database to another.
and we can now check the counts on everything
all Done!

You can get me on Twitter, or the forum and see more about this particular topic at A VBA API for scriptDB