Writing and modifying an existing workbook using Python

泪湿孤枕 提交于 2019-11-29 15:52:30

Your issue is the OneDrive referenced in your directory is not reachable by the program. This can be caused by many things. Improper credentials, OneDrive is off, or simpler the OneDrive does not allow access from a program rather then a user. Try downloading the file you wish to read and write and save it to a directory stored on your computer and point the program to the new directory and see what happens then.

The error message tuple you get indicates that the RPC server you try to connect to is not available. This failure can happen if the RPC server is offline or if your program cannot connect to the network in which the RPC server resides.

The RPC server is unavailable.

RPC stands for Remote Procedure Call. A RPC server is usually another computer residing somewhere else in your network or a network you are connected to. Via the RPC interface you can send function requests with parameters to the server and the server will execute these requests for you and return the apropriate answer. It mimics regular function calls on your machine with the difference that these function calls are executed on the remote RPC server.

From what you wrote in your explanation of the problem I assume you did not mean to contact a remote server at all to do the necessary task. I would suggest removing or replacing code which tries to connect to a remote service by code which works locally on your machine.

This line points onto a directory structure which refers to a directory called OneDrive. Is this a remote directory? Try to place your spreadsheat somewhere else in a folder you are shure is accessible by the user who runs your program and is not a remote directory.

#connects to workbook I want to modify
wb = xw.Book  (r'C:/Users/vince/OneDrive/Documents/Python/Project/spreadsheet.xlsm')

The following lines also imply a connection to the internet, just by word meaning. I am not familiar with the library you are using, so this could also be just some weird nameing of functions. All I am saying here is, that I am not shure.

#import income statement, balance sheet, and cash flow of AAPL
fd = gm.FinancialsDownloader()
fd_frames = fd.download('AAPL')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!