Dec-29-2022, 09:55 PM
I want to format Excel column to percent. The following code gave me "list indices must be integers or slices, not str" error. The __class__ of Column D is 'str'. Is it because the header is string?
Please advise how to format the columns with %. Thank you.
[attachment=2169]
Please advise how to format the columns with %. Thank you.
wb = xl.load_workbook(fullpath) wsData = wb.worksheets["Data"] wsData.Range("D2:O2").Style = "Percent"or
wsData.Range("D2:O2").NumberFormat = "0.00%"See attachment for data.
[attachment=2169]