Here's a party that has access to all spells with 5 characters:
- Onus the wizard 17/ranger 3 (3 1st level ranger spells)
- Twofa the Tiefling cleric (Tempest Domain) 17/warlock 3 (4 1st/2nd level warlock spells)
- Threen the Forest gnome druid 17
- Fourp the High elf paladin 13/wizard 4
- Fivet the bard 18 (College of Lore)
The Spells
To start off, the wizard feature Spellbook makes any wizard spells attainable during the wizard's preparation. We also have a level 17 cleric who can prepare any cleric spell and a level 17 druid. From here, we will work backwards through the levels to show that all spells are accounted for:
Level 9
There is only one 9th level spell that clerics, druids, and wizards together don't get access to:
- Power Word: Heal (covered by Fivet's bard Spells Known)
Level 8
There is only one 8th level spells that clerics, druids, and wizards together don't get access to:
- Glibness (covered by Fivet's bard Spells Known)
There are zero 6th or 7th level spells that clerics, druids, and wizards don't get access to, so on to:
Level 5
There are six 5th level spells that clerics, druids, and wizards together don't get access to:
- Destructive Wave (covered as one of Twofa's domain spells)
- Swift Quiver (covered by Fivet's first level 18 Magical Secrets)
- Conjure Volley (covered by Fivet's second level 18 Magical Secrets)
- Circle of Power (covered by Fivet's first level 14 Magical Secrets)
- Banishing Smite (covered by Fivet's second level 14 Magical Secrets)
- Antilife Shell (covered by Fivet's bard Spells Known)
Level 4
Fourp can prepare any 4th level or lower paladin spell.
There is only one 4th level spells that clerics, druids, paladins, and wizards together don't get access to:
- Compulsion (covered by Fivet's bard Spells Known)
Level 3
There are three 3rd level spells that only bards, rangers, sorcerers, and warlocks together get access to:
- Lightning Arrow (covered by Fivet's first level 10 Magical Secrets)
- Hunger of Hadar (covered by Fivet's second level 10 Magical Secrets)
- Conjure Barrage (covered by Fivet's first level 6 Additional Magical Secrets)
Level 2
There are two 2nd level spells that only bards, rangers sorcerers, and warlocks together get access to:
- Enthrall (covered by Fivet's bard Spells Known)
- Cordon of Arrows (covered by Fivet's second level 6 Additional Magical Secrets)
Level 1
There are eight 1st level spells that only bards, rangers, sorcerers, and warlocks together get access to:
- Hail of Thorns (covered by Onus's ranger Spells Known)
- Hunter's Mark (covered by Onus's ranger Spells Known)
- Ensnaring Strike (covered by Onus's ranger Spells Known)
- Arms of Hadar (covered by Twofa's warlock Spells Known)
- Armor of Agathys (covered by Twofa's warlock Spells Known)
- Hex (covered by Twofa's warlock Spells Known)
- Hellish Rebuke (covered by Twofa's warlock Spells Known, or Tiefling feature)
- Dissonant Whispers (covered by Fivet's Spells Known)
Cantrips
For cantrips, I will go through each character's cantrips to show they are all covered
Onus (5 wizard cantrips)
- Acid Splash
- Chill Touch
- Fire Bolt
- Shocking Grasp
- Ray of Frost
Twofa (5 cleric cantrips, 2 warlock cantrips)
- Guidance
- Resistance
- Sacred Flame
- Spare the Dying
- Light
- Thaumaturgy - Tiefling Feature
- Eldritch Blast
- Poison Spray
Threena (4 druid cantrips)
- Druidcraft
- Produce Flame
- Shillelagh
- Thorn Whip
- Minor Illusion - Forest Gnome feature
Fourp (5 wizard cantrips (4 from wizard levels, 1 from High Elf feature))
- Blade Ward
- Dancing Lights
- Mage Hand
- Mending
- Message - High Elf feature
Fivet (4 bard cantrips)
- Prestidigitation
- True Strike
- Friends
- Vicious Mockery
More High Elves could have accessed more Wizard cantrips, or as an alternate to using racial features, 10 cantrips could have been accessed using the Magic Initiate feat, but I don't see a way to eliminate the fifth party member.
I pretty obviously cribbed off of David Coffron's original answer, so I hope I haven't missed anything.