The Google Sheets v3 API will be shut down on March 3, 2020. Follow this migration guide to update your applications so that they use the v4 API. Learn more

Set Up Your Client Library

A number of client libraries are provided in various languages. These client libraries make it easier to interact with the Sheets API.

This section is not relevant to applications using the Sheets API at the protocol level, but all application developers should strongly consider using a GData client library to interact with the API.

Java

The Java client library is maintained in an open-source project on Google Project hosting. The Java library itself is distributed as a ZIP file, containing a number of JARs that applications can import in order to gain access to the library.

The Java client library requires JDK 5.0 or greater. The latest version of the Oracle JDK is available from http://www.oracle.com/technetwork/java/index.html.

Unfortunately, due to restrictive licensing, we cannot at this time just give developers a ZIP of all JARs required to interact with the API. Some of the JARs are not available without additional license agreements. Because of this, some of the JARs must be downloaded individually. We sincerely apologize for this inconvenience.

To setup a development environment for working with the Sheets API, perform the following steps.

  1. Download the latest gdata-src.java-*.zip file from the project's Downloads page. Replace * in this case with something like 1.46.0.

  2. Extract the ZIP file into a new directory.

    unzip gdata-src.java-1.46.0.zip -d ./gdata-java-client
    
  3. Copy the JARs from gdata-java-client/gdata/java/lib into a directory included in the application's classpath.

    cp gdata-java-client/gdata/java/lib/* /path/to/application/lib
    
  4. Copy the JARs from gdata-java-client/gdata/java/deps into the application's classpath.

    cp gdata-java-client/gdata/java/deps/* /path/to/application/lib
    
  5. Download the JavaMail API (version 1.4 or greater) from here. Extract the ZIP file and copy mail.jar to the application's classpath.

    unzip javamail1_4_4.zip -d javamail
    cp javamail/javamail-1.4.4/mail.jar /path/to/application/lib
    
  6. If using the Oracle JDK version 1.5, download the JavaBeans Activation Framework from here. Extract the ZIP file and copy activation.jar to the application's classpath.

    unzip jaf-1_1_1.zip -d jaf
    cp jaf/jaf-1.1.1/activation.jar /path/to/application/lib
    
  7. To implement any of the code discussed in this document, use the following class template.

    import com.google.gdata.client.authn.oauth.*;
    import com.google.gdata.client.spreadsheet.*;
    import com.google.gdata.data.*;
    import com.google.gdata.data.batch.*;
    import com.google.gdata.data.spreadsheet.*;
    import com.google.gdata.util.*;
    
    import java.io.IOException;
    import java.net.*;
    import java.util.*;
    
    public class MySpreadsheetIntegration {
      public static void main(String[] args)
          throws AuthenticationException, MalformedURLException, IOException, ServiceException {
    
        // Application code here
    
      }
    }
    
  8. Once the above template is in place, continue reading the rest of this document, applying the Java code samples as necessary.

.NET

The .NET client library is maintained in an open-source project on Google Project hosting. The .NET library itself is distributed as a MSI installer, containing a number of DLLs that applications can import in order to gain access to the library.

The .NET client library requires the .NET Framework 2.0 or greater.

To setup a development environment for working with the Sheets API, perform the following steps.

  1. Download the latest Google_Data_API_Setup_*.msi file from the project's Downloads page. Replace * in this case with something like 1.9.0.0.

  2. Run the installer and follow the instructions in the setup wizard.

  3. To implement any of the code discussed in this document, use the following class template.

    using Google.GData.Client;
    using Google.GData.Spreadsheets;
    
    namespace MySpreadsheetIntegration
    {
      class Program {
        static void Main(string[] args)
        {
    
          // Application code here
    
        }
      }
    }
    
  4. Once the above template is in place, continue reading the rest of this document, applying the .NET code samples as necessary.