I did not expect to see so much contention about this. A company is paying him to do a job, and he is doing that job. Is the problem that he isn't miserable? This baffles me.
Well, the question was whether it was unethical, and the ethics to me seem pretty clear. He is lying to the company about what he's doing and when he's doing it. He also had an agreement with the company to work 40 hours for wages, which he has clearly broken. Neither of those things are ethical in any way shape or form. However resolving this in a just way is now extremely difficult (this is mostly his own fault but…
To me, this is justification to not tell them about it. Programmers are almost always distinct jobs from data entry. That he is only being given this task is harmful to his career as a programmer. Take any discussion about interviewing or careers from here, and all of the discussion about bad programmers repeating 1 year of work over 10 years, and it's pretty obvious this is a weak position to grow in.
Imagine this programmer was applying to a company from here, telling them his only task he was ever given was spreadsheet data entry. And he automated it. It's good, but not when it's the only thing you've done.