How To Read A Currency Symbol From An Xlsx File In Python Using Openpyxl?
I have an .xlsx file that contains the salary information of international workforce of an organization. I'm extracting some of the their details. All goes fine except for their sa
Solution 1:
You could use the number_format
property to find out, here is an example of how you could implement that:
c = ws['A1']
fmt = c.number_format
print(fmt) # >>> for me: #,##0.00\ "€"
symbol = re.search(r"[€£]", fmt)
ifnot symbol:
print("no currency")
else:
print(f"{c.value}{symbol.group(0)}") # >>> 1000 €
Update:
Update2:
forwsin wb:
forrowiniter_rows():
forcellin row:
print(cell.value, cell.number_format)
Post a Comment for "How To Read A Currency Symbol From An Xlsx File In Python Using Openpyxl?"