Inserting data row into Google spreadsheet using JAVA

This example will show you , how to add a row to google spreadsheet. Its assumed that you already have a google spreadsheet. Let say your spreadsheet url like – https://docs.google.com/spreadsheets/d/1L8xtAJfOObsXL-XemliUV10wkDHQNxjn6jKS4XwzYZ8/ but don’t put this url in SPREADSHEET_URL, Use the below url simply change the bold part.

public static final String SPREADSHEET_URL = “https://spreadsheets.google.com/feeds/spreadsheets/1L8xtAJfOObsXL-XemliUV10wkDHQNxjn6jKS4XwzYZ8“; // Fill in google spreadsheet URI

Also replace google account user name and password in the code –

public static final String GOOGLE_ACCOUNT_USERNAME = “xxxxx@gmail.com“; // Fill in google account username
public static final String GOOGLE_ACCOUNT_PASSWORD = “xxxxx“; // Fill in google account password

add-row-spreadsheet

Highlighted row has been added by this example program.

Output:

new row
name: Mark
age: 20
email: test@gmail.com
new row
name: Batt
age: 25
email: batt@gmail.com
new row
name: Lie
age: 18
email: lie@gmail.com
new row
name: Bob
age: 26
email: bob@gmail.com

Gopal Das
Follow me

Gopal Das

Founder at GopalDas.Org
He is a technology evangelist, Salesforce trainer, blogger, and working as a Salesforce Technical Lead. After working in Java based project implementation, he jumped to the Salesforce system on a whim and never looked back. He fell in love with Salesforce’s flexibility, scalability, and power. He expanded his knowledge of the platform and became a Certified App Builder, Administrator, Platform Developer I, SalesCloud Consultant while leading the Salesforce implementation and technology needs. He has worked in a wide variety of applications/services like desktop, web and mobile applications.
Gopal Das
Follow me

Leave a Reply

Your email address will not be published. Required fields are marked *