I feel like if you're asking how to shove Python into a spreadsheet app, you've made a mistake somewhere in your process and should reconsider everything.
[1] https://www.microsoft.com/en-us/microsoft-365/python-in-exce...
However. If those sheets hadn't existed earlier on, I might not have a job at all because they business wouldn't have been able to easily/cheaply solve the problems that they did