add sum row after heading or end of file