Java Automation

I am trying to get a sum total of a column in an automation that will send out an email showing the new total every time an amount is added. I was tasked to create an automation running a script, but I am very new to script writing. Any help would be most appreciated