Save Data Variable to text file


Is there any way to sava a data variable into a txt or a cvs file? Im tinkering on my storage database app, and I would like to save search results in a txt file. Is there any possibility to do this?

Any help is appreciated.

Best wishes,

Possibly unrelated, but I´m using Firefoo to upload / download from Firebase. Its easy to get all my data in csv, manipulate it and reload it.

Thank you so much, Firefoo helps a lot!