I decided to put together a basic API for VBA so you could use Parse directly from Excel. It needs some refinement, and I'll add capabilities to it if necessary. Let me know on Forum gadget if you are using it, and how its working out. This will be based around the parse.com rest API - in other words calls to the custom VBA cParseCom class will be translated in rest API calls to Parse. All the code referenced here is available in the cDataSet.xlsm workbook, which you can download from Project Downloads
Before we get started, you'll need to get logged on to parse.com, create an application and get some authentication keys. The 2 keys we will need for the current incarnation of the VBA parse API, are the application ID and the restAPI key.
Let's get the topic of credential storage out of the way, before we dive into using Parse from VBA. Knowing what to do with these API keys in VBA in always a pain - you don't want to have to duplicate them in every workbook that needs to access your data - so I'm going to take the same approach as I took for OAUTH2 and VBA, namely to encrypt theses and store them in the registry. This means you only have to register your application once on a pc, and then any other workbooks using the same credentials on that PC will get them from the encrypted registry. Again I recommend you have a separate workbook for your keys, and run the authentication process just once.
It looks like this. The optional arguments are so you can have multiple applications and scopes on the same PC. We'll look at that in more detail later, and just use the defaults for now.
Every workbook that wants to use parse.com on this PC will just have to do this from then on.
These credentials are encrypted in the registry. If you don't have the CAPICOM encryption dll loaded on your PC, you'll need to get it from Microsoft as described in Google Oauth2 VBA authentication
It's probably too grand to call it an API, but for the lack of a better term, lets stick with that
You'll need to get registered with Parse, download cdataset.xlsm, and run the initial authentication as described on this page, and create some classes to play around with. A parse.com class is like a table, and you can look at them through your parse.com dashboard. We'll work through the examples in the parseCom module of cDataSet.xslm.
Since this is Excel, the first job with the new API is to see how to create and populate a couple of classes from some given worksheets. Here's the start of the first sheet - some customer data.
and here's some order data
I've provided a general purpose sub, populateFromSheet, for this, which we'll look at in a moment. This will create a class for each sheet, with each object named the same as the columns in the table.
Here's the parse.com dashboard, after I've run this - we have the two new classes, populated with the appropriate records
And here's the code to do it.
You can get me on Google plus, Twitter or this forum.
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Parse.com >