google-apps-script DriveApp Service Create new file in Google Drive of a certain Mime type

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

function createGoogleDriveFileOfMimeType() {
  var content,fileName,newFile;//Declare variable names
  
  fileName = "Test File " + new Date().toString().slice(0,15);//Create a new file name with date on end
  content = "This is the file Content";

  newFile = DriveApp.createFile(fileName,content,MimeType.JAVASCRIPT);//Create a new file in the root folder
};


Got any google-apps-script Question?