How to convert the data inside Excel from HEX to ASCII using python?

Hi all I’m new to python still trying to know my road around it so What I’m trying to do it to convert the data in specific cells in excel from HEX to ASCII but I’m stuck with this error

TypeError: fromhex() argument must be str, not Cell

so far that’s my code if u can help me

import openpyxl as op import pandas as pd import os os.chdir('c:/sheets') wb1 = op.load_workbook('Try.xlsx')  sheet = wb1.get_sheet_by_name('Sheet1')   b = sheet.max_row + 1  z = 1  for i in range (z, b):     hex_string = sheet["Row A"][i]          bytes_object = bytes.fromhex(hex_string)          ascii_string = bytes_object.decode("ASCII")          sheet['A'+x] = ascii_string  wb.save('Try2.xlsx') 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.