Getting token in Excel VBA

Hi,

We have an Excel tool that we have connected with an in-house Python package that is hosted on an API server using VBA. The package uses specklepy to connect with Speckle, so when we run the server locally, the personal access token is automatically retrieved from the Speckle Manager. However, on the server we have a problem, since the personal access token has to be provided in the request.

We would like to avoid asking the users to provide the token themselves in the Excel, so I was wondering if there’s a way to retrieve this token somehow in VBA.

Best,
Knut

Hi Knut,

Assuming the user is using Excel desktop, the best way would be to use the token stored by Manager.
This would require creating a similar functionality to the AccountManager class we have in .NET, where the token is retrieved from an SQLite db. Here’s the current implementation: speckle-sharp/AccountManager.cs at main · specklesystems/speckle-sharp · GitHub

Alternatively, you could look into developing a JS adding for excel and use a web flow like our Excel connector does: speckle-excel/index.js at main · specklesystems/speckle-excel · GitHub

Hi Matteo,

Thanks for the response!

The first solution seems straightforward enough, so I will see if we can implement it like that.
The second solution does seem interesting, as there are actually several other advantages of having an addin, because now we are adding buttons to the ribbon that call macros. Only problem is that our team’s JS skills is severely limited…

1 Like