• PyByte
  • Posts
  • 🚨 It's finally here! Python in Excel

🚨 It's finally here! Python in Excel

PyByte 0.3

from PyByte import whats_new, trick_of_the_week, get_inspired, fun_or_funny

# Welcome to the PyByte!

👋 Hey, and thanks for joining PyByte, a quick way to inject Python into your week!

whats_new()

🚨 Python in Excel is now available to all users in the Beta channel! 🚨

A match made in Azure (still bitter Python doesn’t run locally 🙃).

To get access, you need to have a Office 365 subscription on a Windows machine and then make sure you’re on the Beta channel.

To run your first script in Excel:

1. Select Formulas in the ribbon

2. Select Insert Python.

3. In the dialog that appears, select the Try preview button.

I have been playing around with it this week and for once in a long time, I am stoked about using Excel.

trick_of_the_week()

Unused code presents several problems, which include:

  • Making it way harder to read and understand code. 🤔

  • Adds excessive utilization of memory and resources. 😵

  • Your coworkers might make fun of you. 🙃

Awkward Season 4 GIF by The Office

Gif by theoffice on Giphy

The below code has an unused import and an unused function 😥

To help you identify and remove unused Python code, use Vulture!

First, install vulture with pip.

$ pip install vulture

Then enter the following into your terminal/command line/Powershell on your script.

$ vulture myscript.py  # or
$ python3 -m vulture myscript.py
$ vulture myscript.py mypackage/
$ vulture myscript.py --min-confidence 100  # Only report 100% dead code.

get_inspired()

If you’re anything like me, it’s sometimes hard to motivate yourself to get started on something. 😰

Some mornings I find it difficult to activate my brain and dig into work in the morning, or forcing myself to go for a morning run, or even just getting out of bed. 💤

Life can be a struggle, especially when that voice is telling me to not do the thing I want the benefit of by doing.

The 5 second rule is a hack that primes the pump and gets momentum going.

Watch this mind-blowing 🤯 short explaining it!

fun_or_funny()

From X/Twitter:

See you next week 👋

Joel