can we implement ctrl+shift+[ and ctrl+shift+{ as the shortcut keys for our custom addin functionality to be hit

priyanka anusuri 20 Reputation points
2026-06-18T14:32:34.4533333+00:00

we have an Office 365 excel Add-in in web browser and we want to trigger few functionalities when we hit these ctrl+shift+[ and ctrl+shift+{ .

is it possible to do if yes what are all the ways we have

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments

Answer accepted by question author

Jay Tr 13,460 Reputation points Microsoft External Staff Moderator
2026-06-22T21:55:59.76+00:00

Hi priyanka

Thank you for your response.

To answer your question, you can absolutely make it work the way you described. The quickkeys.json plus functions.ts approach is the correct and fully supported method, so the issue is most likely how the pieces are connected rather than your overall idea.

First, an important clarification about the snippet I shared earlier. The keydown listener code should not be placed in functions.ts, which is why it did not work for you. That file is your command entry point in the runtime, not a focused page listening for keystrokes, so a listener there will never fire. Please remove it, since the sample based approach you are following does not use it at all.

The way this is meant to work is that your quickkeys.json defines each action and the key that triggers it, and your functions.ts then connects that same action to your real function using Office.actions.associate. You do not paste your logic loose into the file. Instead, you pass associate a function that holds the logic to run when the shortcut is pressed:

Office.actions.associate("ChangeColor", function () {
  // your logic goes here
  return;
});

The first argument, "ChangeColor", must match the action id defined in your quickkeys.json. The second argument is the function that runs when that shortcut fires, and that function is where your actual logic lives.

Since you already have your feature implementations written for your ribbon buttons, you do not need to duplicate that code. You can simply call your existing function from inside the associated function, so the shortcut and the ribbon button both run the same underlying logic:

Office.actions.associate("ChangeColor", function () {
  return myExistingFunction();
});

So the chain is that a key press makes Office look up the key in quickkeys.json, find the matching action id, and then run the function you associated with that id.

I hope this clarifies your question. Should you have any further questions, please feel free to reach out and let me know. I'll be happy to help.

If you found this helpful, please kindly upvote it so that other users in this forum can also benefit from this.

Thank you for your time and patience. Wishing you a great day ahead.

Was this answer helpful?

1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Jay Tr 13,460 Reputation points Microsoft External Staff Moderator
    2026-06-18T16:31:40.9633333+00:00

    Hi priyanka

    Thank you for reaching out and for sharing your concern. 

    To trigger features when Ctrl+Shift+[ and Ctrl+Shift+{ are pressed, I would recommend using a JavaScript listener inside your add-in's task pane. An Office add-in is essentially a web page that Excel loads, and it does not include any keyboard shortcut by default, so this listener is what gives it the ability to respond to a key combination. The listener and the functions you want to run both live inside the same add-in page, so when the listener detects the keys it simply calls your function directly. 

    Here is a basic example you can use: 

    document.addEventListener("keydown", function (event) {
      // Ctrl + Shift + [ (the "{" character is produced by Shift + [)
      if (event.ctrlKey && event.shiftKey && event.key === "{") {
        event.preventDefault();
        runFeatureOne();
      }
    });
    function runFeatureOne() {
      // Your functionality goes here
      console.log("Feature triggered");
    }
    
    

    To quickly test this code in your browser console, please follow these steps: 

    1. Open your add-in in the browser so the task pane is visible. 
    2. Right click anywhere inside the task pane and select Inspect to open the browser developer tools. 
    3. In the developer tools window, select the Console tab. 
    4. Paste the code above into the console and press Enter to register the listener. 
    5. Click inside the task pane, then press Ctrl+Shift+[ to confirm the function runs. You should see the "Feature triggered" message appear in the console. 

    Please note that code entered directly in the console is temporary and only lasts for the current session. Once you have confirmed it works, you would move the same code into the JavaScript file loaded by your task pane so it runs automatically each time the add-in opens. 

    One point worth noting is that Ctrl+Shift+[ and Ctrl+Shift+{ are produced by the same physical key, since the { character is simply Shift plus the [ key. Because of this, the two cannot be reliably distinguished as separate shortcuts, so if you need two different features triggered, I would suggest using two distinct keys instead. 

    Another important limitation is focus. This listener only works while the user is clicked inside the task pane. As soon as focus moves to the spreadsheet cells, the page no longer receives the keystrokes, so the listener will not fire. 

    I hope this information is helpful. Please follow the steps above and let me know if it works for you. If not, we can continue working together to resolve the issue.  

    Thank you for your patience and understanding. If you have any questions or need additional assistance, please don’t hesitate to reach out so I can continue to support you. If you found the response useful, please consider marking it as accepted, as this may help other community members who are looking for similar guidance.  

    I look forward to continuing the conversation.  


    If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.     

    Was this answer helpful?


  2. AI answer

    2026-06-18T14:33:00.35+00:00

    Yes, it is possible to define custom shortcuts for an Office Excel add-in, but there are important constraints and browser limitations to consider.

    1. Allowed key combinations for add-ins
      Custom shortcuts must follow the Office add-in rules:
      • Must include at least one modifier key (Alt/Option, Ctrl/Cmd, Shift) and only one other key, joined with + (for example, Ctrl+Shift+A).
      • Allowed non-modifier keys are A–Z, 0–9, and the punctuation marks -, _, and +.
      • When two characters share the same physical key, they are treated as synonyms (for example, Ctrl+- and Ctrl+_).
      Because { and [ are produced from the same physical key on many keyboard layouts (for example, [ vs { via Shift), Office treats shortcuts by physical key, not by the shifted character. So Ctrl+Shift+[ and Ctrl+Shift+{ would effectively be the same shortcut from the add-in’s perspective.
    2. Browser and web limitations
      For Office on the web:
      • Custom keyboard shortcuts only work when focus is on the document (worksheet), not when focus is in the task pane.
      • Some browser-reserved shortcuts cannot be overridden by add-ins (for example, Ctrl+X, Ctrl+C, Ctrl+V, etc.). The documented list does not include Ctrl+Shift+[ specifically, so it is not known from this context to be blocked by the browser.
    3. Defining the shortcuts in an Excel add-in
      To implement custom shortcuts such as Ctrl+Shift+[:
      • Configure the add-in to use a shared runtime.
      • Create a shortcuts JSON file and define actions and shortcuts:
        • Each action has an actions.id and actions.name.
        • Each shortcut maps a shortcuts.action to a shortcuts.key.default and optionally platform-specific keys (windows, mac, web).
      • Link the shortcuts JSON file in the add-in manifest using the ExtendedOverrides element.
      • Use Office.actions.associate in the shared runtime to map each action ID to the corresponding JavaScript function that implements the custom functionality.
    4. Conflict handling and best practices
      • Excel and other add-ins may already use certain shortcuts. When a conflict exists, the first time the user presses the shortcut, Office shows a dialog listing all registered actions and lets the user choose which one to use. The user’s choice is then saved as a preference.
      • To minimize conflicts, guidance recommends using patterns like Ctrl+Shift+Alt+X and avoiding established Excel shortcuts.
      • On the web, some shortcuts cannot be overridden at all due to browser reservations; if Ctrl+Shift+[ is one of those in practice, it will not be usable even if defined in the manifest.
    5. Checking availability and user customization
      • Use Office.actions.areShortcutsInUse to check whether a planned shortcut (for example, Ctrl+Shift+1) is already in use before assigning it.
      • Use Office.actions.getShortcuts() to inspect the shortcuts currently registered for the user.

    In summary, defining a shortcut like Ctrl+Shift+[ for an Excel web add-in is supported by the add-in keyboard shortcut framework if the browser does not reserve it, but { vs [ cannot be distinguished as separate shortcuts because they share the same physical key. Implementation is done via the shortcuts JSON file, shared runtime, and Office.actions.associate.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.