We always laugh at movies about ancient Egypt when someone drags out the Book of the Dead, as if it was a real book. But the Book of the Dead is not a book. It's a nickname for the many magical spells that the ancient Egyptians believed actually worked.
Egyptologists have deciphered about 200 different spells, most written to help the ancient Egyptians reach their afterlife safely. Some were written on papyrus. Some were written on tomb walls. These were not secret spells. People had their favorites.
Wealthy Egyptians hired scribes to create fancy designs on sheets of papyrus, each with a spell, that they could include with their grave goods. But you could buy a ready-made spell in the marketplace. A ready-made was a spell on a piece of papyrus, with blanks where you could write in your name. They were very popular. The spells you chose were placed in your tomb.
Written spells were also important because they offered one more place to write down your name. In ancient Egypt, you needed your name written down so your Ba and Ka (your two souls) could find their way home at night to your tomb. To the ancient Egyptians, if the Ba and Ka could not find their way home, you could not live in the afterlife, and you would disappear forever!