I've done this many times.
In one instance it wasn't my task, but the task of 2 employees that I was supervising. My boss had given them a task that took each of them 8 hours to complete (turning phone logs into readable reports, daily). One would start the process and hand her work off to the other which was then turned into management at the end of the second shift. Each day, processing the logs from the previous day. At best, the report data was 24 hours old - often indicating trends after it was too late to deal with them.
The IT department had tasked several of their workers to automate the task but none were able to do it over the course of 6 months.
I spent three days learning what these ladies were doing and another three days coding it. When I was done, management could get the report they wanted up to the previous hour, and it was searchable.
At the end of the day, I got two workers back on the phones doing what they were hired to do.
I quit two days later - but that's another story.