The incident occurred shortly before 6pm on Thursday near the Ziegelbrücke station, where the train carrying 100 passengers was headed, the SDA news agency reported.
The train driver braked when he saw the cattle on the tracks but was unable to avoid the crash.
Six cows were killed instantly while a seventh was seriously injured and had to be destroyed, SDA said.
The animals wandered on to the tracks for an undetermined reason from a nearby field.
None of the train passengers was injured.
The rail line was closed throughout the evening as crews worked to removed the bodies of the dead animals from beneath the train.
SBB said the line was due to reopen on Friday morning.