скопируйте диапазон в sheet2 и вставьте его в лист 1 - PullRequest
0 голосов
/ 01 марта 2019

Я пытаюсь скопировать диапазон на листе 2 и вставить его на лист 1. Кажется, что мой код может выполнить копирование, но не может выполнить вставку.Пожалуйста помоги.Спасибо, что нашли время помочь.

tickers_sheet = client.open('XBRL_Y_BS_Names').get_worksheet(2)
cik_ranges = ['C2:C150','F2:F150']

for x in cik_ranges:
    cik_list = tickers_sheet.range(x)
    for i in cik_list:
        print(i.value)
    call_sheet = client.open('XBRL_Y_BS_Names').get_worksheet(1)
# paste the results to range P22:P170 in call_sheet:
    call_sheet.update_cells('P22:P170',i)

Ошибка, похоже, последняя строка:

Traceback (most recent call last):
  File "C:/PyCodes/Tickers.py", line 23, in <module>
    call_sheet.update_cells('P22:P170',i)
  File "C:\Users\BuiTi\AppData\Roaming\Python\Python37\site-packages\gspread\models.py", line 769, in update_cells
    values_rect = cell_list_to_rect(cell_list)
  File "C:\Users\BuiTi\AppData\Roaming\Python\Python37\site-packages\gspread\utils.py", line 233, in cell_list_to_rect
    row_offset = cell_list[0].row
AttributeError: 'str' object has no attribute 'row'

Process finished with exit code 1
...