Ecclesiastes 1:1. "The words of the congregator, the son of David, the king in Jerusalem."
The one who fits that description in the simplest, literal way was Solomon. In the event,
"The spirit of Jehovah spoke through me; His word was on my tongue", said David, on his deathbed.
"For prophecy was at no time brought by man's will, but men spoke from God as they were moved by holy spirit", said Peter, to the congregations everywhere.
"All Scripture is inspired of God and beneficial for teaching, for reproving, for setting things straight, for disciplining in righteousness, so that the man of God may be fully competent, completely equipped for every good work." That's Paul, speaking on the "last days". In the case of Ec 3, there are reminders of the passage of time and the things which should properly occupy us. Cf. Ec 12:13,14.
So there's One who directs the writing, the one of whom Jesus said, "your word is truth."
An understandable oversight, since most of the churches you know of worship 'the God that dare not speak his name.'