TL;DR: The quote comes from a 1917 work by William James. James says Goethe wrote it in 1824, but in fact it was first published in 1836 (in German) by Johann Eckermann, as part of Eckermann's autobiographical recollections of Goethe's conversations with him, this particular conversation taking place in 1824. However, the version given by James may not be the most faithful translation.
Almost all references point to the book The Varieties of Religious Experience by William James (full text available online here), published in 1917. It's subtitled "A Study in Human Nature / Being the Gifford Lectures on Natural Religion Delivered at Edinburgh in 1901-1902".
At page 174, James writes:
When such a conquering optimist as Goethe can express himself in this
wise, how must it be with less successful men?
“I will say nothing,” writes Goethe in 1824, “against the course of my
existence. But at bottom it has been nothing but pain and burden, and
I can affirm that during the whole of my 75 years, I have not had four
weeks of genuine well-being. It is but the perpetual rolling of a rock
that must be raised up again forever.”
However, the quote also appears in Darwin by Gamaliel Bradford, published in 1926 (text available online here), at page 275. Bradford writes:
When we turn to Goethe, we find perhaps little more regard for sexual
morals than with Sainte-Beuve, but at any rate a temperament far
better poised, and to all appearances charged and glorified with
luminous serenity. Yet with Goethe also the scientific spirit, even
though enriched with the artist's delight and the artist's creative
power, could not bring happiness in its train. The sorrows and
sufferings of Werther might perhaps be accredited to the extravagance
of youth. But in extreme old age we hear Goethe proclaiming the
emptiness and misery of life in terms almost as bitter and complete as
those of Sainte-Beuve or of Anatole France. 'I will say nothing,' he
said to Eckermann, 'against the course of my existence. But at bottom
it has been nothing but pain and burden, and I can affirm that during
the whole of my 75 years I have not had four weeks of genuine
well-being. It is but the perpetual rolling of a rock that must be
raised up again forever.'
A footnote for the quote states "Conversations with Eckermann, quoted in William James, Varieties of Religious Experience, p. 137."
Interestingly, nowhere in Varieties does James mention Eckerman, so it's unclear how Bradford came to this conclusion. However, to be doubly sure, I tracked down the alleged source, Gespräche mit Goethe ("Conversations with Goethe, Conversations with Eckermann") by Johann Peter Eckermann, published 1836 (Vols I & II) and 1848 (Vol III). Goethe's conversation with Eckerman on Tuesday 27th January 1824 includes the following statement by Goethe:
“Man hat mich immer als einen vom Glück besonders Begünstigten gepriesen; auch will ich mich nicht beklagen und den Gang meines Lebens nicht schelten. Allein im Grunde ist es nichts als Mühe und Arbeit gewesen, und ich kann wohl sagen, daß ich in meinen fünf und siebzig Jahren keine vier Wochen eigentliches Behagen gehabt. Es war das ewige Wälzen eines Steines, der immer von neuem gehoben seyn wollte.”
The original English translation was by S. M. Fuller (page 76 of the revised 1852 edition):
"I have ever been esteemed one of Fortune's chiefest favorites; nor
can I complain of the course my life has taken. Yet, truly, there has
been nothing but toil and care; and, in my seventy-fifth year, I may
say, that I have never had four weeks of genuine pleasure. The stone
was ever to be rolled up anew."
Wikipedia notes that John Oxenford regarded her translation as "almost an abridgement". Oxenford's own translation (1850), at page 125, gives Goethe as saying:
"I have ever been esteemed one of Fortune's chiefest favourites; nor
will I complain or find fault with the course my life has taken. Yet,
truly, there has been nothing but toil and care, and I may say that,
in all my seventy-five years, I have never had a month of genuine
comfort. It has been the perpetual rolling of a stone, which I have
always had to raise anew."
It's pertinent to note that Wikipedia adds the following (without citation):
Subsequent translators, however, have taken great liberty with
Eckermann's work, greatly reducing the autobiographical material and
substantially altering his prose, rather than offering faithful
renderings in English.
It seems reasonable, on the basis of all the above, to conclude that James relied on another (and possibly less accurate) translation of this passage; and he incorrectly attributed the writing of it to Goethe, whereas the author was actually Eckermann in his autobiographical recollection of what Goethe said to him.