title: How to write a DataFrame schema to file in Scala
body: <p>I have a DataFrame that loads from a huge json file and gets the schema from it. The schema is basically around 1000 columns. I want the same output of printSchema to be saved in a file instead of the console.</p>
  
  <p>Any ideas?</p>