Creating a document in Google Drive.


The GDrive component can be used to create a new document in Google Drive using the UploadFile method. This can be done by first setting the ResourceIndex property to -1 and then passing the MIME type for the desired format to UploadFile.

For example, below is some sample code to create a new Google Sheet:

C# gdrive1.ResourceIndex = -1; gdrive1.UploadFile("New Spreadsheet Name", "application/vnd.google-apps.spreadsheet");
Some other popular Google document MIME types are:
  • application/vnd.google-apps.document
  • application/vnd.google-apps.drawing
  • application/vnd.google-apps.file
  • application/vnd.google-apps.form
  • application/vnd.google-apps.fusiontable
  • application/vnd.google-apps.kix
  • application/vnd.google-apps.presentation
  • application/vnd.google-apps.script
  • application/vnd.google-apps.sites
  • application/vnd.google-apps.spreadsheet

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.