I am using the modules xlwd
, xlwt
and xlutil
to do some Excel manipulations in Python. I am not able to figure out how to copy the value of cell (X,Y)
to cell (A,B)
in the same sheet of an Excel file in Python. Could someone let me know how to do that?
import xlrd
import xlwt
import xlutils
from xlutils.copy import copy
r_book = xlrd.open_workbook(fname)
w_book = xlutils.copy.copy(r_book)
r_sheet = r_book.sheets()[0] # Taking the first sheet
w_sheet = w_book.get_sheet(0)
x_y_value = r_sheet.cell(X, Y).value
w_sheet.write(A, B, x_y_value)
w_book.save(fname)