I am using xlrd, xlwt and so on; Write the exceltes library and read excel sheet in reading, then I have read successfully and am amp; Written to Excel Sheet
But I need some guidelines in capturing the format of that cell from which I am reading & amp; Applying the same format in the room that I am writing.
Below I've tried -
# Open Excel Sheet & amp; Refer to Tab1 rb = open_workbook (r'C: \ users \ abc \ excel.xls', formatting_info = true) sheet = rb.sheet_by_name ("tab1") # Search excel sheet for string and return to cell def searchStringCell Find Location (Search String): In Category (Sheet. NRO): Line = sheet.row_values (i) Category: Jammu (Lennon): If line [j] == searchString: return i, j # Search string header = '& lt; Title & gt; HeaderTitleX, headerTitleY = searchStringCell (headerTitleX, headerTitleY) Print "Title Cell: (", HeadTitleX, "," HeaderTitleY, ")" Write data to # cell, which is 2 columns of right cell first Only wb = copy (rb) w_sheet = wb.get_sheet (0) read w_sheet.write (headerTitleX, headerTitleY + 2, 'new data') # Try it below; Not sure what to do fmt = rb.xf_list [cell.xf_index] bg = fmt.background.pattern_colour_index rgb = wb.colour_map [bg] # save changes wb.save (r'C: \ users \ abc \ excel Xls ')
I have tried to read fmt, bg & amp; RGB from letter; But I am unsure of how to apply the same format of the cell in which the data has been read & amp; Apply it to a new cell Thank you.
No comments:
Post a Comment