Answer the question
In order to leave comments, you need to log in
Uploading a file from cloud storage?
You need to download the file from the cloud storage using the link. It is advisable to download from Yandex disk. When running the code:
base_url = 'https://cloud-api.yandex.net/v1/disk/public/resources/download?'
public_key = 'link' # Сюда вписываете вашу ссылку
#Получаем загрузочную ссылку
final_url = base_url + urlencode(dict(public_key=public_key))
response = requests.get(final_url)
download_url = response.json()['href']
#Загружаем файл и сохраняем его
download_response = requests.get(download_url)
with open(' file name', 'wb') as f: # Здесь укажите нужный путь к файлу
wb = f.write(download_response.content)
Answer the question
In order to leave comments, you need to log in
egor_u , well, that's the answer. If you read the documentation a little , you will see that the .write() method returns the number of bytes read.
I don't know what you expected to get in the wb variable before executing wb = openpyxl.load_workbook(wb)
, but this is clearly not it.
In general, load_workbook() expects to receive the path and name of the file to be opened as input.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question