Create a new document with your selected layers and place them next to each other, ordered by the order of your layers
- Close krita
- Move the content of this project to your "pykrita" folder (for windows at %appdata%/krita/pykrita)
- Open Krita and go to (Settings > Configure krita > Python plugin manager)
- Check the plugin "SpriteSheet generator"
- Reload krita
- Select the layers you want to export into a sprite sheet (this will create a new document with the layers you selected)
- After select your layers go to (Tools > Scripts > Generate SpriteSheet)