Giter Club home page Giter Club logo

learncodespace's Introduction

Create Codespace

  1. Create codespace and point to https://github.com/shaofengzhu/learncodespace.git
  2. Run app.py
  3. Setup port forward using VS code as there is bug when using browser port forward.
  4. Configure local HTTPS reverse proxy for the port-forwrad as Excel requires HTTPS web site.
REM Only need to run office-addin-dev-certs once
npx office-addin-dev-certs install --days 365
REM The <port> is the port created by VS code port forward
npx office-addin-https-reverse-proxy --port 5500 --url http://localhost:<port>

Excel

  1. Access https://localhost:5500/functions.html, click "Generate Manifest", then save the manifst file.

  2. Access https://microsoft-my.sharepoint-df.com/, create a Excel file

  3. Click "Insert" -> "Add-ins", in the dialog, click the "Manage My Add-ins" -> "Upload My Add-in", use the file you saved in step 1.

  4. Now, a new Ribbon tab "Python" will show up. Please click "Python" -> "Show Taskpane", then in the taskpane, click "Register Functions with Excel".

  5. Now, you could type in "=PYTHON.ADD(1,2)" in the Excel.

Add a new function

To add a new function, please go to codespace, stop run app.py, then modify the functions.py, add some code like

@customfunctions.customfunction(name = "MYMUL")
def mymull(x, y):
	return x * y

Run the app.py

Now, go to Excel, click the "Python" -> "Show Taskpane", click "Register Functions with Excel".

Troubleshooting

If you created a new codespace

Please cleanup the browser cache, and generate a new manifest.

If officepy package does not work

Inside codespace, please

pip3 install -r requirements.txt

learncodespace's People

Contributors

shaofengzhu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.