简体   繁体   中英

How to add currency to excel cell using python xlrd

I have a cell which denotes, it is currency value. TO be more specific, US currency ($). I don't want to do string manipulation since formula which depends on this cell will fail.

It's quite simple than I thought. But wasted a few minutes looking for an answer online. Thought It might help someone.

    sheet = workbook.get_sheet(0)
    style = xlwt.XFStyle()
    style.num_format_str = '$#,##0.00'
    sheet.write(row, col, value, style)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM