Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisprice committed Dec 13, 2023
0 parents commit 6c6ebaf
Show file tree
Hide file tree
Showing 13 changed files with 748 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
cert.pem
key.pem
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# OpenAI API Formulas for Excel

## Usage instructions

1. Add the plugin to Excel by following the [sideloading instructions for your platform](https://learn.microsoft.com/en-us/office/dev/add-ins/testing/test-debug-office-add-ins#sideload-an-office-add-in-for-testing).
2. Start typing the following in a formula bar `OAI.` and you should see the formulas associated with this plugin.
3. For a full description of each function, see `src/functions.json`.

## File descriptions

| Path | Description |
| ---- | ----------- |
| assets/*.png | Icons of various sizes |
| index.html | Root page loaded in the background during plugin startup. |
| manifest-local.xml | A version of manifest.xml which references https://localhost:3000/ for plugin development use. |
| manifest.xml | Configures where the plugin should be loaded from and what features it will make use of. |
| package[-lock].json | Lists NPM dependencies. Used only during plugin development. |
| functions.js | The JavaScript functions which implement the formulas. |
| functions.json | The metadata which details each formula and references its implementation. |
| README.md | This file. |

## Plugin development

1. Install the npm dependencies (`npm i`)
2. Follow these instructions to [generate an cert-key pair](https://github.com/http-party/http-server#tlsssl).
3. Run the local server (`npm start`).
4. Navigate to the [root](https://localhost:3000/) in your browser and temporarily trust the newly created cert-key pair.
4. Open a spreadsheet in Excel on the web and append the following query string parameters
```
wdaddindevserverport=3000&wdaddinmanifestfile=manifest-localhost.xml&wdaddinmanifestguid=00aeeb98-f4d9-4db0-a1e6-cdc652c08e34
```
5. If you are prompted to enable Excel developer mode, do so.

You should now be able to use the formulas as normal. If you make a change to `index.html` or `src/*`, you will need to reload the browser window.
Binary file added assets/icon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon-80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>
<script type="module" src="src/functions/functions.js"></script>
</head>

<body>
</body>

</html>
72 changes: 72 additions & 0 deletions manifest-localhost.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
<Id>00aeeb98-f4d9-4db0-a1e6-cdc652c08e34</Id>
<Version>1.0.0.0</Version>
<ProviderName>Chris Price &amp; Robat Williams</ProviderName>
<DefaultLocale>en-GB</DefaultLocale>
<DisplayName DefaultValue="OpenAI API Formulas for Excel"/>
<Description DefaultValue="Invoke the OpenAI API calls from formula."/>
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/>
<SupportUrl DefaultValue="https://github.com/robatwilliams/openai-excel-formulas"/>
<AppDomains>
<AppDomain>https://localhost:3000</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Workbook"/>
</Hosts>
<Requirements>
<Sets DefaultMinVersion="1.1">
<Set Name="SharedRuntime" MinVersion="1.1"/>
</Sets>
</Requirements>
<DefaultSettings>
<SourceLocation DefaultValue="https://localhost:3000/index.html"/>
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Workbook">
<Runtimes>
<Runtime resid="Shared.Url" lifetime="long" />
</Runtimes>
<AllFormFactors>
<ExtensionPoint xsi:type="CustomFunctions">
<Script>
<SourceLocation resid="Functions.Script.Url"/>
</Script>
<Page>
<SourceLocation resid="Shared.Url"/>
</Page>
<Metadata>
<SourceLocation resid="Functions.Metadata.Url"/>
</Metadata>
<Namespace resid="Functions.Namespace"/>
</ExtensionPoint>
</AllFormFactors>

<DesktopFormFactor>
<FunctionFile resid="Shared.Url"/>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="Functions.Script.Url" DefaultValue="https://localhost:3000/src/functions/functions.js"/>
<bt:Url id="Functions.Metadata.Url" DefaultValue="https://localhost:3000/src/functions/functions.json"/>
<bt:Url id="Shared.Url" DefaultValue="https://localhost:3000/index.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="Functions.Namespace" DefaultValue="OAI"/>
</bt:ShortStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
72 changes: 72 additions & 0 deletions manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
<Id>00aeeb98-f4d9-4db0-a1e6-cdc652c08e34</Id>
<Version>1.0.0.0</Version>
<ProviderName>Chris Price &amp; Robat Williams</ProviderName>
<DefaultLocale>en-GB</DefaultLocale>
<DisplayName DefaultValue="OpenAI API Formulas for Excel"/>
<Description DefaultValue="Invoke the OpenAI API calls from formula."/>
<IconUrl DefaultValue="https://robatwilliams.github.io/openai-excel-formulas/assets/icon-32.png"/>
<HighResolutionIconUrl DefaultValue="https://robatwilliams.github.io/openai-excel-formulas/assets/icon-64.png"/>
<SupportUrl DefaultValue="https://github.com/robatwilliams/openai-excel-formulas"/>
<AppDomains>
<AppDomain>https://robatwilliams.github.io</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Workbook"/>
</Hosts>
<Requirements>
<Sets DefaultMinVersion="1.1">
<Set Name="SharedRuntime" MinVersion="1.1"/>
</Sets>
</Requirements>
<DefaultSettings>
<SourceLocation DefaultValue="https://robatwilliams.github.io/openai-excel-formulas/index.html"/>
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Workbook">
<Runtimes>
<Runtime resid="Shared.Url" lifetime="long" />
</Runtimes>
<AllFormFactors>
<ExtensionPoint xsi:type="CustomFunctions">
<Script>
<SourceLocation resid="Functions.Script.Url"/>
</Script>
<Page>
<SourceLocation resid="Shared.Url"/>
</Page>
<Metadata>
<SourceLocation resid="Functions.Metadata.Url"/>
</Metadata>
<Namespace resid="Functions.Namespace"/>
</ExtensionPoint>
</AllFormFactors>

<DesktopFormFactor>
<FunctionFile resid="Shared.Url"/>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://robatwilliams.github.io/openai-excel-formulas/assets/icon-16.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://robatwilliams.github.io/openai-excel-formulas/assets/icon-32.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://robatwilliams.github.io/openai-excel-formulas/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="Functions.Script.Url" DefaultValue="https://github.com/robatwilliams/openai-excel-formulas/src/functions/functions.js"/>
<bt:Url id="Functions.Metadata.Url" DefaultValue="https://github.com/robatwilliams/openai-excel-formulas/src/functions/functions.json"/>
<bt:Url id="Shared.Url" DefaultValue="https://robatwilliams.github.io/openai-excel-formulas/index.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="Functions.Namespace" DefaultValue="OAI"/>
</bt:ShortStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
Loading

0 comments on commit 6c6ebaf

Please sign in to comment.