Python worksheet: accessing and processing text