Installing packages from saved lists

I have saved list from
pacman -Qqe and Qqm
I now want to install from those lists. Probably from asking wrong questions I found lots of help with saving the list but none using the lists. Can yay handle both, or pamac?

You have everything you need in archwiki → pacman.

There is several methods to feed input from other sources than STDIN - so it is likely - and it is easy to test.

pamac install $(cat pkglist.txt)

pacman

pacman -S - < pkglist.txt

Yay takes input same way as pacman

yay -S - < pkglist.txt

Thank you very much. Worked like a breeze.