Loading...

Building on our previous exploration of how to integrate Salesforce to Google Sheets using apps in a comprehensive blog, we are back again to guide you through the intricacies of integrating Salesforce to Google Sheets utilizing Google APIs.

Emphasizing the utilization of APIs for real-time data synchronization, this integration promises to revolutionize the way you handle and collaborate on data. It streamlines data management and enhances collaboration by ensuring that your Salesforce data is seamlessly accessible and synchronized with your Google Sheets.

So, let’s begin and demonstrate how to update contact records in Google Sheets, created in Salesforce through APIs.

Set up a Google Cloud Platform Project to Integrate Salesforce to Google Sheets using API

  • Head to the Google Cloud Console.
  • You can either select a new project or choose an existing one.
  • Next is enabling the Google Sheets API for your project.
  • Create credentials for a service account, and download the JSON key file.
select a new project

>> Provide the desired Name for Project here, Here I’ve given the name Google Sheet Test.

Provide the desired Name for Project

>> In the search box, write Google Sheet and select the Google Sheets API option.

select the Google Sheets API

>> Click on Enable API

Click on Enable API

>> Click on the left corner, then click on API & Services, once the box will get opened click on Credentials and then click on Create Credentials.

click on API Services

>> As the Create Credentials box opens, Click on OAuth Client ID.

Click on OAuth Client ID 1

>> To create an OAuth client ID, we need to Configure Consent Screen.

Configure Consent Screen

>> In Authentication Type, Select Web Application.

Select Web Application

>> Provide the ‘Name’ for your OAuth Client ID and Create it.

Provide the ‘Name’

>> Once the OAuth page opens, Copy the Client Id and Client Secret.

Copy the Client Id

> In Salesforce Org

Setup >> Quick Find Box >> Enter Auth >> Click on Auth Provider >> Click on New.

Select Google

>> In Provider Type, Select Google.

Select Google

>> Following Box will be opened.

Following Box will be opened

>> In consumer key, Mention the copied OAuth client Id and In consumer Secret, Mention the copied client secret.

Authorize Endpoint URL

https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force

Token Endpoint URL

https://accounts.google.com/o/oauth2/accessToken

Default Scopes

https://www.googleapis.com/auth/spreadsheets

In Authorize Endpoint URL, Token EndPoint URL and Default Scopes mentioned above Url. Once you will save the auth Provider, the callback Url will be generated so, copy the callback url.

Mention the copied client secret

>> Mention the callback Url in OAuth Client Id.

Mention the callback Url

>> In the Quick Find Box, Enter Named Credentials in the left corner. Click on the drop-down box and click on New Legacy.

Enter Named Credentials

> For creating new Named Credentials provide the desired Label, In the URL, mention this URL –
https://sheets.googleapis.com

In Identity type, select Named Principle, and In Authentication Protocol, Select OAuth 2.0.
For Authentication Provider, Click on the glass icon, Select the Authenticator Provider which you have created in Auth and Click on ‘Save’ button.

Click on the glass icon

>> As you click on ‘Save’ button, It will redirect you to verify your email.

verify your email

>> Click on Continue.

Click on Continue

>> Again, Click on Continue.

Again, Click on Continue.

>> Once you process all the steps, it will redirect you back to your Salesforce org.

redirect you back to your Salesforce org

> Once we have completed all the above mentioned steps for authentication, we have to create a custom button and we have to set it on the contact record page as we will click on the button. It will sync your contact to google sheet and it will be appended on the sheet.

> Controller Class – GoogleSheetApi.cls

We have set the EndPoint –
req.setEndpoint(‘callout:GoogleSheetApi/v4/spreadsheets/1SyhGgtSdU9f8zeNKWCGBZ3om3D8pOo2uoKhOELASLvo/values/Sheet1:append?valueInputOption=RAW’);We have mentioned the sheet Id in the endpoint.

create a custom button

>> HTML Class – googleSheetTest.html’
>>
Here, we have created a custom button on the page and added this component on the standard contact page, as you will click on the button, the contact will be synced with google sheet.

>> JS Class – googleSheetTest.js
>> In the Js file, we have imported controller class and method and also we have imported showToastEvent. Here we have used api,wire and track decorator. Api decorator will provide current page record Id and appendRowbyID is variable name for controller class.

>> We have added the button on the Standard Contact Page.

add the button

>> Once you click on the button, the contact will be synced with the sheet.

contact will be synced with the sheet

>> The Contact will be available on the sheet.

Contact will be available on the sheet

Conclusion

So, here it is! This is how we can seamlessly integrate Salesforce to Google Sheets and update contact records in it.

So what are you waiting for? Go ahead and try out the solution. Feel free to share your suggestions or reach out to us for any Salesforce development Services.

No Data Found.

Related Articles
How to Integrate NikoHealth to Salesforce

Healthcare organizations using NikoHealth often need patient, insurance, order, invoice, and prescription data available inside Salesforce. As data grows, manually updating records across systems becomes difficult and can lead to delays, duplicate work, and data inconsistencies. NikoHealth to Salesforce integration helps solve this challenge by automatically synchronizing data between both platforms. Instead of building custom […]

Read More
Orchestrator vs. Traditional Flows

Businesses use Salesforce automation to reduce manual work, improve efficiency, and automate repetitive business processes. Two commonly used automation approaches inside Salesforce are Traditional Flows and Flow Orchestrator. Traditional Flows are mainly used for simple automation tasks such as updating records, sending notifications, creating tasks, and automating business logic. Flow Orchestrator is designed for more […]

Read More
The Rise of Agentic Government_ What Salesforce’s 2026 Insights Mean for the Future of Public Sector AI

Government technology has often been seen as slower to evolve than the private sector. But Salesforce’s latest research challenges that idea in a big way. In fact, the new findings suggest that public sector organizations may now be moving faster than many businesses when it comes to adopting AI agents and preparing for a more […]

Read More
How To Use Email Service in APEX

Managing approvals, updates, and record changes directly from email can significantly improve efficiency within Salesforce workflows. Instead of logging in, navigating records, and manually updating fields, users can simply respond to emails and trigger automated updates using Email Service in APEX. This approach is especially useful for businesses leveraging Salesforce automation and looking to enhance […]

Read More
Design and Implementation of Salesforce Jira Task Integration 1 1

Businesses have been using Salesforce for CRM operations and Jira for Agile project tracking. However, without integration, teams manually update both systems, leading to data inconsistency and inefficiency.This mechanism establishes a real-time integration between Salesforce and Jira, allowing seamless synchronization of tasks and agile board statuses.  A custom Salesforce dashboard was developed that replicates Jira-style […]

Read More
Dark Mode in Salesforce Enabling It and Creating Theme Ready Lightning Web Components with SLDS 2.0 1 1

With the Winter ’26 release, Salesforce introduced Dark Mode in Lightning Experience. Dark Mode has been introduced as a beta feature in Winter ’26, and at first it was available only for Starter Edition orgs. It is now rolling out further with Spring ’26 to Professional, Enterprise, and Developer editions. To use Dark Mode, Salesforce […]

Read More
Our Location worldwide
Indian Flag India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203239658
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada Canada
HIC Global Solutions INC
6D - 7398 Yonge St #1124 Thornhill, ON L4J 8J2 Canada +1(262) 310-7818