Following tutorial will guide you for “Google Calendar Integration with Salesforce“. I am assuming that you have some experience with Salesforce development as I am not referring basic terms here.

Step 1. Register a project at https://code.google.com/apis/console

Google Calendar Integration with salesforce

Step 2: Enable Calendar API

Google Calendar integration with Saleforce

Step 3 : After activating Calendar API create Client ID as shown in below screenshot. Please remember to replace na3.salesforce.com with your Salesforce instance.

Step 4 : Copy your Client ID and Client Secret.

Step 5 : Button on Task Object.

Create new button on Task Object and add that to Task Page layout.

Step 6 : Copy and Paste following code in above window after replacing your client id and secret copied in step 4.

var clientId = 'YOUR_CLIENT_ID';
var apiKey = 'YOUR_API_KEY'; 

var scopes = 'https://www.googleapis.com/auth/calendar'; 

// Use a button to handle authentication the first time.
function handleClientLoad() {
gapi.client.setApiKey(apiKey);
window.setTimeout(checkAuth,1);
} 

function checkAuth() {
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult);
} 

function handleAuthResult(authResult) {
// var authorizeButton = document.getElementById('authorize-button');
if (authResult && !authResult.error) { 

makeApiCall(); 

} else {
handleAuthClick();
}
} 

function handleAuthClick() {
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);
return false;
} 

// Load the API and make an API call. Display the results on the screen.
function makeApiCall() {
AddEvent();
}
function AddEvent()
{
var startdate='{!YEAR(DATEVALUE(Task.CreatedDate))}' + '-' + '{!MONTH(DATEVALUE(Task.CreatedDate))}' + '-' + '{!DAY(DATEVALUE(Task.CreatedDate))}';
var enddate='{!YEAR(Task.ActivityDate)}' + '-' + '{!MONTH(Task.ActivityDate)}' + '-' + '{!DAY(Task.ActivityDate)}'; 

var resource = {
"summary":"{!Task.Subject}",
"description": "{!Task.Description}",
"start": {
"date": startdate
},
"end": {
"date": enddate
}
};
gapi.client.load('calendar', 'v3', function() {
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': resource
});
request.execute(function(resp) {
console.log(resp);
if (resp.id){
alert("Event was successfully added to the calendar!");
}
else{
alert("An error occurred. Please try again later.")
} 

});
}); 

}
{!REQUIRESCRIPT("https://apis.google.com/js/client.js?onload=handleClientLoad")};
handleClientLoad()

Step 6 : You can modify some fields at

Event Name : Line 42

Event Description : Line 43

Event start date : Line 38

Event end date : Line 39

Step 6 : To test above code create a new task and define start and end date and Click Create task in Google Cal button. It will create new event in your calendar after authentication.