Openpyxl工作表对象没有属性move_range

时间:2019-09-03 17:00:45

标签: python pandas openpyxl

我有以下代码,由于某些原因,它在move_range上出错。我正在使用openpyxl版本2.5.12。我尝试更新至2.6,但随后引入了一些与Pandas不建议使用的NaT功能有关的错误,因此,如果可能,我希望保留在2.5.12上。我还包括了以下从openpyxl导入的模块。

import openpyxl

from openpyxl import load_workbook

from openpyxl import Workbook

from openpyxl.utils import get_column_letter

from openpyxl.worksheet.table import Table, TableStyleInfo

from openpyxl.worksheet.cell_range import CellRange

from openpyxl.worksheet.worksheet import Worksheet

from openpyxl.worksheet import worksheet

from openpyxl import worksheet


book = load_workbook(extract_file_loc)

wb = Workbook()
ws = wb.active
book.active = 4
ws = book.active
data = gpatuple

ws.append(gp_headers_tp)
  for row in data:
     ws.append(row)

tab = Table(displayName="PATH_FILE", ref=final_cord)

# Add a default style with striped rows and banded columns
style = TableStyleInfo(name="TableStyleMedium2", showRowStripes=True)
tab.tableStyleInfo = style
ws.add_table(tab)
ws.move_range("G4:H10", rows=-1, cols=2)
ws.move_range(final_cord, rows=-1,cols=0)
book.save("extract.xlsx")
print "complete!"

0 个答案:

没有答案