0

Code syntax for win32com to trim excel cell value with leading spaces?

In VBA is trim(cells(1,1).value)

Johnseito
  • 315
  • 1
  • 9
  • 24
  • As opposed to python's in-built `strip()` method? – Alan Jul 14 '17 at 23:01
  • I get error message when using it. AttributeError: NoneType object has not attribute strip – Johnseito Jul 14 '17 at 23:25
  • It gave me that error because the cell value was blank, no content to strip from, but strip() work. Thx – Johnseito Jul 14 '17 at 23:35
  • Yes, just wrap the process up in a test - e.g. check the length of the contents of the cell - and run strip if length > 0. Then you won't get NoneType error. – Alan Jul 14 '17 at 23:47

0 Answers0