Other answers do not answer the question; they provide an alternative. The question is how to install iFrame src from C #. I will answer it here.
I’m all for the “right tools for the job” and I use this mantra myself, but only when the other tools are “wrong”. It has not been installed here. Can anyone give a good technical reason why this should not be done in code?
I think the @Pepys problem could be due to something in the url that it hasn't provided yet. For example, perhaps its URL includes ampersands or other characters that need to be escaped.
The following code works great for me:
excelframe.Attributes["src"] = @"https://r.office.microsoft.com/r/rlidExcelEmbed?" + @"su=-0000000000" + @"&Fi=zzzzzzzzzzzz!111" + @"&ak=x%3d9%26x%3d9%26x%3d!zzzzzzzzzz" + @"&kip=1" + @"&AllowTyping=True" + @"&ActiveCell='sheet1'!C3" + @"&wdHideGridlines=True" + @"&wdHideHeaders=True" + @"&wdDownloadButton=True";
source share