microsoft / python-in-excel

Python in Microsoft Excel
MIT License
490 stars 31 forks source link

Https requests? #20

Open JanElholm opened 10 months ago

JanElholm commented 10 months ago

Happy to see python in Excel :-)

I get a ProxyError when trying to make https requests using the requests library. Is this by design?

import requests URL = "https://www.geeksforgeeks.org/data-structures/" r = requests.get(URL) r.content

Thanks!

keyur32 commented 10 months ago

Hi there, yes, for data security reasons the Python code does not have network access. You must use Excel to import the data directly. You can use PowerQuery to get that data from the website, and then analyzing it separately in Python. Details here: https://support.microsoft.com/en-us/office/using-power-query-data-with-python-in-excel-028dbcd4-76c5-4aa4-831d-0e211fefc0a2

JanElholm commented 10 months ago

Thanks for quick response. Unfortunately the restrictions on python in excel are a deal-breaker for me. I expected something like jupyter notebook - but in excel - or even a replacement of VBA with python /Jan

jflam commented 10 months ago

Sorry to hear that. We need to provide strong security guarantees - especially against data exfiltration via Python.

leandrobi commented 10 months ago

Very sad to read this. I was really looking forward to being able to make requests by passing parameters and headers within a excel cell to api's and returning the data in excel. Could this at least be implemented in the future?

keyur32 commented 10 months ago

Hi, in the interest of time, we plan to enable organizations to setup their own custom environments. We're looking for feedback on what aspects organizations would like to customize including network support. For our standard environment, as @jflam mentioned above, due to data exfiltration being a concern we hear over and over again from IT admins, we do not have plans to enable network access for our standard environment.

For your scenario, @leandrobi, we are looking to improve ways to pull in data into Excel. Today, you can use PowerQuery, Custom Functions, Office Scripts, or Macros to pull in data into the grid and then analyze it using your python code.

ismasanchez commented 8 months ago

Hi, this limits enormously the possibilities that python could bring to Excel. I've been testing it and honestly, I'm quite disappointed. In my opinion right now it is just like an add-on so you can use python data science libraries in Excel. I was hoping for a VBA replacement. Apart from all that, I still don't understand why we can't run it locally and it must be run on a server within your premises.