Skip to main content

Classification within Sheets

GPT for Sheets can help you classify your catalog items, press articles, or any other text into the most relevant category without leaving Google Sheets. This guide walks you through classifying a list of product names for a shoe store into categories, and improving your classification approach to get the best results.

While you can also use the GPT_CLASSIFY function to perform this task, we'll focus on using the Custom prompt bulk tool in this guide.

Step 1: Get started

Prerequisites

Open the GPT for Sheets add-on and run the Classify bulk tool with categories Casual Shoes, Dress Shoes, Athletic Shoes, Boots, Sandals, Sneakers on a few rows to see how it works.

Select Extensions, GPT for Sheets and Docs, and Open. Then Bulk tools tab, Classify / Categorize.

If you find the answers satisfactory, go ahead and launch your bulk classification! Otherwise, check how to improve your results in Step 2.

Step 2: Improve your results (optional)

To obtain the best results when classifying your text, consider the following approaches. All solutions use the minimum Creativity level and Top P setting, and gpt-4o for more accuracy.

GoalRecommended approach
Classify according to specific rulesAdd custom instructions
Provide context or specific rules to follow.

Classify flip flops as Casual shoes when their main material is leather.
Handle content outside categoriesAdd a fallback category
Capture all irrelevant content into a fallback category and review it to refine your classification approach. For example, add Other to your list of categories.

Casual Shoes, Dress Shoes, Athletic Shoes, Boots, Sandals, Sneakers, Other
Reduce use of 'Other' categoryMake categories broader
Make categories broader to ensure that all text is classified. For example, change Knee-high boots into Boots.
Balance categoriesRefine categories
Check that your categories are balanced. For example, if you have a category Summer shoes that is over-represented, you can split it into narrower categories.

Sandals, Espadrilles, Flip-flops
Improve accuracyMake categories mutually exclusive
Check your category for overlaps. For example, Sandals and Summer Shoes are not mutually exclusive, so you should keep only one of them.
Classify into most specific category in a hierarchyUse full paths to describe your hierarchy
In a hierarchical system, use the full path of your most specific categories instead of providing a flat list of categories.

Casual Shoes/Boat shoes, Casual Shoes/Sneakers, Dress Shoes/High heels/Stilettos, Dress shoes/High heels/Wedges
Define categoriesCreate a list of categories of a given type with the Extract bulk tool
If you know the type of categories you want to classify your text into, but don't know all the categories in advance, extract all possible categories as entities with the Extract bulk tool. Then, classify the text based on this list. For example, to classify shoe descriptions by their main material, extract all the materials first, then classify the descriptions using the list of materials to identify the main material for each type of shoe.
Once you have refined your classification approch and are satisfied with the results from the initial rows, you are ready to launch your classification in bulk. Select more cells or even all cells, click Run rows, and watch GPT for Sheets handle the rest of the classification.