How to Do Sentiment Analysis in Google Sheets
Performing sentiment analysis on customer feedback or social media comments can feel like a job for a data scientist, but you can get powerful insights right inside a tool you already use every day: Google Sheets. This article will show you three practical methods for analyzing positive, negative, and neutral sentiment directly in your spreadsheets, from a simple formula-based approach to more advanced techniques.
What Exactly is Sentiment Analysis?
Sentiment analysis is the process of identifying and categorizing the emotion or opinion within a piece of text. In simple terms, it's about figuring out if the writer's attitude is positive, negative, or neutral. For any business, this is an incredibly valuable way to systematically understand customer attitudes at scale.
Instead of manually reading thousands of lines of feedback, you can use sentiment analysis to automatically process things like:
- Product reviews from your e-commerce site
- Survey responses from a customer satisfaction (CSAT) survey
- Comments from your social media posts
- Support ticket feedback
- Mentions of your brand across the web
By quantifying this qualitative data, you can quickly spot trends, identify areas for improvement, and get a clear, data-backed view of how people feel about your brand, products, or campaigns.
Method 1: Quick & Easy Keyword-Based Sentiment Analysis
This is the most straightforward method. It doesn’t require any add-ons, scripts, or coding. We'll build a simple system using formulas to score text based on a list of positive and negative keywords. It's not perfect - it can't understand nuance or sarcasm - but it's a fantastic starting point for basic analysis.
Step 1: Set Up Your Data and Keyword Dictionary
First, get your data into a Google Sheet. Create a sheet named "Feedback" and paste your text data (e.g., customer reviews) into Column A.
Next, create a second sheet named "Dictionary". This is where we will list our positive and negative keywords. In Column A, list all the positive words you can think of ("love," "amazing," "great," "excellent," "fast," "easy," etc.). In Column B, list all the negative words ("hate," "bad," "slow," "difficult," "broken," "frustrating"). The more comprehensive your lists, the more accurate your analysis will be.
Step 2: Score Positive and Negative Mentions
Now, let's go back to the "Feedback" sheet. We’ll use a formula to count how many positive keywords appear in each piece of feedback. In cell B1, add the header "Positive Score". In cell B2, enter this formula:
=ARRAYFORMULA(SUM(COUNTIF(A2, "*"&Dictionary!$A$2:$A&"*")))
Let's break that down:
Dictionary!$A$2:$Arefers to your list of positive words.COUNTIF(A2, "*"&...&"*")checks if any of those words appear in the text in cell A2. The asterisks are wildcards, meaning it will find the word "great" even if it's part of a larger string like "is great!".SUM()adds up the count of all found positive words.ARRAYFORMULA()allows theCOUNTIFto check for every word in your dictionary list at once.
Next, in cell C1, add the header "Negative Score". In cell C2, use a similar formula referencing your negative keywords:
=ARRAYFORMULA(SUM(COUNTIF(A2, "*"&Dictionary!$B$2:$B&"*")))
Now, drag both formulas down to apply them to all your feedback rows.
Step 3: Calculate the Final Sentiment
Finally, we'll create an overall sentiment label. In cell D1, add the header "Overall Sentiment". Our logic will be: if positive score is greater than negative score, the sentiment is "Positive". If the negative score is higher, it's "Negative". If they are equal (including both being zero), we'll call it "Neutral".
Enter this formula in cell D2:
=IF(B2>C2, "Positive", IF(C2>B2, "Negative", "Neutral"))
Drag this formula down, and you have your very own sentiment analysis! You can now create a pivot table or charts to summarize how much of your feedback is positive, negative, or neutral.
Method 2: Using an AI Add-on for Better Accuracy
The keyword method is a great start, but its limitations are clear. A phrase like "not bad" might be incorrectly scored as negative. For more sophisticated analysis without needing to code, you can use a Google Sheets add-on that leverages pre-trained AI models.
Step 1: Install a Suitable Add-on
Google offers a marketplace full of tools that extend the functionality of Sheets. To find one, go to the menu and select Extensions > Add-ons > Get add-ons. Search for terms like "sentiment analysis," "AI," or "NLP" (Natural Language Processing).
Look for an add-on with good reviews and clear documentation. Installation is usually a one-click process that involves granting the add-on permission to access your sheet data.
Step 2: Use the Add-on's Custom Function
Once installed, most of these tools provide one or more custom functions you can use just like any other spreadsheet formula. For example, the function might be something simple like:
=SENTIMENT(A2)
You would enter this formula next to your text, and it would return a classification ("Positive," "Negative," "Neutral") or even a numerical score. Because these tools use sophisticated machine learning models, they are much better at understanding context and nuance than our simple keyword counter.
The main trade-off is that many add-ons have usage limits on their free plans and may require a paid subscription for high-volume analysis.
Method 3: Integrating a Third-Party API with Apps Script (Advanced)
For the most powerful and customizable solution, you can connect Google Sheets to a dedicated Natural Language Processing (NLP) API using Google Apps Script. This approach gives you access to a world-class AI model (from providers like Google Cloud AI, AWS, or others) and lets you control the process completely. This method requires some comfort with basic scripting.
Step 1: Get an API Key
First, you'll need to sign up for a service that offers an NLP API, such as the Google Cloud Natural Language API. You will typically need to create a project and enable the API to get an API key, which is a unique string that authenticates your requests.
Step 2: Write a Custom Function in Apps Script
In your Google Sheet, go to Extensions > Apps Script. This opens up a code editor. Replace any boilerplate code with a function that sends your text to the API. Here is a simplified example of what that script might look like for Google's API:
function analyzeSentiment(text) { const apiKey = "YOUR_API_KEY", // Replace with your actual API key const apiEndpoint = "https://language.googleapis.com/v1beta2/documents:analyzeSentiment?key=" + apiKey,
// Prepare the data to send to the API const data = { document: { content: text, type: 'PLAIN_TEXT' }, encodingType: 'UTF8' },
const options = { method: 'post', contentType: 'application/json', payload: JSON.stringify(data) },
// Make the API call const response = UrlFetchApp.fetch(apiEndpoint, options), const jsonResponse = JSON.parse(response.getContentText()),
// Return the sentiment score from the API's response const score = jsonResponse.documentSentiment.score,
if (score > 0.2) { return "Positive", } else if (score < -0.2) { return "Negative", } else { return "Neutral", } }
After pasting your code (and your API key), save the script project. Make sure you give it a memorable name, like "SentimentAPI".
Step 3: Use Your Custom Function in the Sheet
Now, you can use the function you just created directly in a cell. Go back to your sheet and type:
=analyzeSentiment(A2)
The first time you run it, you may be asked to grant the script permission to connect to an external service. After that, your script will send the text in A2 to the API, get the result, and display it right in the cell.
Visualizing Your Findings
Analyzing the sentiment is only half the battle, the other half is presenting it clearly. Once you have a column with "Positive," "Negative," and "Neutral" labels, you can use Google Sheets' charting tools to create a simple dashboard.
A pie chart is perfect for showing the overall breakdown of sentiment across all your feedback. A column or bar chart can help you track sentiment over time or compare sentiment scores across different products, campaigns, or customer segments.
Final Thoughts
Google Sheets provides an accessible, low-cost platform for performing powerful sentiment analysis, whether you're using simple formulas or advanced API calls. It transforms raw, unstructured feedback into a measurable metric you can use to make better business decisions and truly understand your customer's voice.
While running an analysis in a spreadsheet is great for a static list of comments, it can become tricky when you need to combine feedback from your store, with social media commentary, and with survey results. This is where we built Graphed to help. Simply connect your platforms (like Shopify, Google Analytics, social media ads, and even Google Sheets) and ask questions in plain English like, "show me a dashboard of my Shopify product reviews sentiment score." We instantly create live, real-time dashboards so you can spend less time wrangling formulas and more time acting on insights.
Related Articles
How to Enable Data Analysis in Excel
Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.