I think `str(counter + 1)` can be longer than `str(counter)` and `name[:31 - len(...)]` should be `name[:32 - len(...)]` since `len(d)` is at least 1? Unless the maximum sheet name is actually 31 (quite possible if it includes a null at the end or a len at the front inside XLS). Maybe something like:

```
suffix = " %d" % (counter + 1)
return workbook.add_sheet("%s%s" % (name[:32 - len(suffix)], suffix))
```

would make this less torturous?