The work done on the cell / by the cell is given as,
ΔG = -nFE
Where nF is used to determined the total charge passed into / out of the cell and E is the cell potential.
If E is positive, ΔG is negative.
If E is negative, ΔG is positive.
The reaction is spontaneous (the cell does work) when ΔG is negative (E is positive).
The reaction needs to be driven by an outside source (work done on the cell) when ΔG is positive (E is negative).