8

I would like to be able to edit my Office Scripts in Visual Studio Code. I know, that I can paste and copy my Scripts from VS to the Office Scripts Editor and vice-versa. But, I think, it would be more comfortable to be able to directly open, edit and save my Scripts from my OneDrive with VS.

So my question is, do you know any plugin or way to get the OSTS files read by VS and re-encoded to JSON when saving them back?

Best, Mourad

Mourad Louha
  • 113
  • 7

2 Answers2

2

Depending on which Office Scripts you are referring to, there should be a solution.

  • Office Scripts for Add-ins with Script Lab => Scripts can be stored in and accessed from GitHub. So, no problem getting them from VS.
  • Office Scripts for Excel on the Web (accessed from the Automate tab in Excel Online) => Scripts are stored in your OneDrive for Business storage in a folder named \Documents\Office Scripts, therefore you should also be able to open that folder in VS.

Let us know if that helps.

Best

David

  • 2
    David, thank you very much for your support. However, my issue is not opening the files in Visual Studio. When opening the files for Office Scripts in VS Code, I see something like this: `{"version":"0.1.0","body":"async function main(context: ...` So, I am searching for a way to get that files automatically transformed from JSON to an editable mode and then on saving get it transformed back to the JSON format. I guess, this would only be possible with a kind of plugin (?) and my question, is do you or someone else know such a plugin. Best, Mourad – Mourad Louha Apr 29 '20 at 12:13
  • OK, got you. Good point, I couldn't figure out how to edit the TypeScript code within the JSON format. I couldn't find anything relevant for that purpose. – David Gerard Apr 29 '20 at 19:06
  • this can at least extract the typescript from the json ```jq -r '.body' ./officeScript.osts > script.js``` – swv Aug 23 '21 at 21:01
2

Editing Office Scripts with VS Code is now in preview

Brian Gonzalez
  • 1,178
  • 1
  • 3
  • 15
  • 1
    Have you been able to enable this? There are only 3 steps listed there, but I can't seem to find the "Editor Settings", so I created https://stackoverflow.com/questions/75759705/where-is-the-settings-for-connecting-office-scripts-to-vs-code-web – swv Mar 16 '23 at 17:40