Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store a key like LABS.GENERATIVEAI #5236

Closed
chengtie opened this issue Jan 3, 2025 · 2 comments
Closed

Store a key like LABS.GENERATIVEAI #5236

chengtie opened this issue Jan 3, 2025 · 2 comments
Assignees
Labels
Area: Excel Issue related to Excel add-ins Needs: author feedback Waiting for author (creator) of Issue to provide more info Resolution: question answered Question is answered by engineering team.

Comments

@chengtie
Copy link

chengtie commented Jan 3, 2025

Hello,

We have published several Excel add-ins, we would like to enable users to use their own OpenAI kpi key in our tools as LABS.GENERATIVEAI of Excel Labs does:

Screenshot 2025-01-03 at 09 41 41

"This OpenAI account key is stored in your machine's local Excel settings and is shared across workbooks on your machine, but it's not saved in the workbook or shared with other users who open the workbook." ==> Does anyone know which JavaScript Excel API enables a saving of key like that?

Thank you

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Jan 3, 2025
@guoms1 guoms1 added Needs: attention 👋 Waiting on Microsoft to provide feedback Area: Excel Issue related to Excel add-ins and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Jan 3, 2025
@guoms1 guoms1 self-assigned this Jan 3, 2025
@guoms1
Copy link

guoms1 commented Jan 3, 2025

Hi, @chengtie

Thank you for reaching out! Based on the behavior you described—storing a key in a machine's local Excel settings and sharing it across workbooks without embedding it into the workbook—it’s worth noting that this isn’t a standard feature of the Office JavaScript API for Office Add-ins.

However, you can achieve similar functionality using custom local storage mechanisms. Specifically, you can leverage the browser's localStorage or IndexedDB in Excel desktop apps (which use an embedded web browser for running add-ins). This approach allows you to store keys locally on the machine and share them across workbooks, but they won’t be accessible to other users or devices.

Here’s an example of how this can be implemented with localStorage:

// Save a key to localStorage
localStorage.setItem("apiKey", "your-api-key");

// Retrieve the key
const apiKey = localStorage.getItem("apiKey");
console.log("Retrieved API key:", apiKey);

Let me know if you have any questions or need further guidance. I’d be happy to help!

Best regards,

@guoms1 guoms1 added Needs: author feedback Waiting for author (creator) of Issue to provide more info Resolution: question answered Question is answered by engineering team. and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Jan 3, 2025
@guoms1
Copy link

guoms1 commented Jan 6, 2025

I believe your issue has been resolved so I'll go ahead and close this issue for now, but please don't hesitate to reopen it or create a new issue if you have further questions or need additional assistance.

Have a great day!

@guoms1 guoms1 closed this as completed Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Excel Issue related to Excel add-ins Needs: author feedback Waiting for author (creator) of Issue to provide more info Resolution: question answered Question is answered by engineering team.
Projects
None yet
Development

No branches or pull requests

2 participants