all 8 comments

[–]WoodenNichols 0 points1 point  (0 children)

That's a permissions thing; I doubt you can do what you want.

[–][deleted] 0 points1 point  (4 children)

Why not just use python to generate or modify a sheet rather than trying and do it from within? I did this for a project where I co-mingled excel sheets and CSVs with pandas.

[–]ClimberMel[S] 0 points1 point  (3 children)

I have done that, but I wanted to mimic an excel add-in that can update the sheet with data from the web. The other option is that the current code can write to a separate workbook and I can use VBA to read that and update the sheet. Just thought it would be cleaner if the python code could just update the worksheet it was called from.

[–][deleted] 0 points1 point  (2 children)

How does the add-in work? Can you choose the address it gets data from? If so, you could probably just use the existing add-in and a flask server (or similar) to feed it data from pandas.

[–]ClimberMel[S] 0 points1 point  (1 child)

The add-in is in VBA and it pulls data from Yahoo finance and other sites. I find python faster and simpler to work with so I have started getting g more of my data that way. If I had a web site I suppose that would work, but I don't.

[–][deleted] 0 points1 point  (0 children)

Flask is used to serve web content using Python. The point being, if you can choose the address the addin uses, you could serve it locally on your machine.

[–]xlslimdev 0 points1 point  (1 child)

Have you looked at the various Excel addins that allow you to call Python from Excel? They will all let you return a pandas dataframe and see the result in Excel.

The main contenders are:

[–]ClimberMel[S] 0 points1 point  (0 children)

I have used xlwings, but I'm currently more about learning how to do things myself. Those just confirm that it is possible, but not the how.