This Google Sheets script provides a custom function, GENAI_SPAMCLASS
, to classify text as SPAM or NOT SPAM using the Gemini language model.
- Replace
YOUR_GEMINI_API_KEY
with your actual API key. - Add this script to your Google Sheets' script editor.
- Use the function
=GENAI_SPAMCLASS(range)
in your sheets, whererange
is the range of cells containing text to classify.
=GENAI_SPAMCLASS(A1:A10)
- This will classify each cell in the range A1:A10 and return the results in the corresponding cells.