I'm creating an add-on for Google Spreadsheets which has custom formulas (functions) that require the user's API keys to run. I'm wondering what is the best way to store the user's API keys everytime they use the add-on in a new spreadsheet.
This is an example workflow:
- User installs add-on in spreadsheet for the first time
- Prompt user for API key
- Store API key
- User can now use custom formula that calls the API with the stored API key
- User creates a new spreadsheet, and installs the add-on again.
- User can still use the custom formula that calls the API because the API key is stored in the add-on's storage
According to this https://developers.google.com/apps-script/guides/properties, it seems like the correct Properties Serivce is getUserProperties() but from testing, it doesn't seem like anything I add into the Properties Service persists across different spreadsheets.
Or should I be storing these API keys in an external database?