title: How do I insert new sheet in Existing google spreadsheet using vb.net?
body: <p>I am manage to create spreadsheet on google drive using following code.
  Now I want to add new sheets in that created spreadsheet.</p>
  <p>When I Create new spreadsheet , it contains default sheet having name Sheet1 but I want to rename that sheet or insert more than one sheets in Spreadsheet</p>
  <pre><code>Public Function Create(ByVal FileName As String) As String
          Try
  
              Dim service = GetGoogleAPPDriveService()
  
  
              Dim fileMetadata = New Google.Apis.Drive.v3.Data.File()
              fileMetadata.Name = FileName
              fileMetadata.MimeType = &quot;application/vnd.google-apps.spreadsheet&quot;
  
              Dim request As FilesResource.CreateRequest = service.Files.Create(fileMetadata)
  
              request.SupportsTeamDrives = True
              request.Fields = &quot;id&quot;
              System.Net.ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf AcceptAllcertification)
              Dim file = request.Execute
  
              Return file.Id
  
          Catch ex As Exception
              Throw ex
          End Try
      End Function 
  
  Private Function GetGoogleAPPDriveService() As DriveService
          Try
              Dim Scopes1 As String() = {DriveService.Scope.Drive, DriveService.Scope.DriveFile}
              Dim ClientId As String = &quot;&quot;
              Dim ClientSecret As String = &quot;&quot;
              Dim UserCredentials As UserCredential
  
              Dim stream = New FileStream(&quot;credentials.json&quot;, FileMode.Open, FileAccess.Read)
              ClientId = GoogleClientSecrets.Load(stream).Secrets.ClientId
  
              Dim stream1 = New FileStream(&quot;credentials.json&quot;, FileMode.Open, FileAccess.Read)
              ClientSecret = GoogleClientSecrets.Load(stream1).Secrets.ClientSecret
  
              Dim cs = New ClientSecrets()
              cs.ClientId = ClientId
              cs.ClientSecret = ClientSecret
  
              UserCredentials = GoogleWebAuthorizationBroker.AuthorizeAsync(cs, Scopes1, Environment.UserName,
                                                                           CancellationToken.None, New FileDataStore(&quot;MyAppsToken&quot;, True)).Result
  
  
              Dim service = New DriveService(New BaseClientService.Initializer() With {
     .HttpClientInitializer = UserCredentials,
     .ApplicationName = ApplicationName})
  
              Return service
  
  
          Catch ex As Exception
              Throw ex
          End Try
      End Function
  
  Public Function AcceptAllcertification(ByVal sender As Object, ByVal Certification As X509Certificate, ByVal Chain As X509Chain, ByVal sslPolicyErrors As System.Net.Security.SslPolicyErrors) As Boolean
          Return True
      End Function
  
  </code></pre>