Use python to transcribe data in txt to excel according to certain rules