TASK_SEARCH

TASK_SEARCH

Function Overview

TASK_SEARCH allows you to perform web searches directly from Google Sheets using the Tavily API. Results are automatically formatted into a table with titles, URLs, and content snippets, making it easy to bring external search results into your spreadsheets.

Uses

  1. Research competitive products and output key details directly to your spreadsheet
  2. Gather the latest news on specific topics for market analysis reports
  3. Collect information from specific websites by using domain filtering
  4. Find recent research papers on academic subjects by including academic domains
  5. Gather image URLs for visual content related to your query
  6. Create a knowledge base within your spreadsheet by searching for specific information
  7. Monitor news about your company or products by running regular searches
  8. Compile search results from multiple sources for comparison

Syntax and Parameters

=TASK_SEARCH(header, query, [max_results], [include_headings], [advanced_search_depth], [include_images], [include_domains], [exclude_domains])

Parameter Data Type Required Description
header string Yes Column header for the task template
query string Yes The search query to execute
max_results number No Maximum number of results to return (default: 5)
include_headings boolean No Whether to include column headings in the output (default: true)
advanced_search_depth boolean No Whether to use advanced search depth for more thorough results (default: false)
include_images boolean No Whether to include images in the results (default: false)
include_domains string No Comma-delimited list of domains to include in the search
exclude_domains string No Comma-delimited list of domains to exclude from the search

Advanced Options

Domain Filtering

You can narrow your search results to specific websites by using the include_domains parameter. For example, to only get results from Wikipedia, use "wikipedia.org". For multiple domains, separate them with commas: "wikipedia.org,nasa.gov".

Similarly, you can exclude unwanted domains using the exclude_domains parameter.

Search Depth Control

The advanced_search_depth parameter controls how thorough the search is:

  • false (default): Basic search, faster but less comprehensive
  • true: Advanced search, more comprehensive but may take longer to complete

Image Results

When include_images is set to true, your search results will include image URLs related to your query. These appear as additional rows in the results table with "Image" in the content column.

Examples

=TASK_SEARCH("Search Results", "latest AI models", 5, true)

This searches for information about the latest AI models and returns 5 results with column headers. After clicking "Run" in the sidebar, results appear in the cells to the right.

Search specific domains

=TASK_SEARCH("Academic Sources", "quantum computing research", 10, true, true, false, "edu,ac.uk")

This performs an advanced search for quantum computing research, limited to academic domains (.edu and .ac.uk), returning 10 results.

Search with images

=TASK_SEARCH("Travel Destinations", "best beaches in Greece", 5, true, false, true)

This searches for information about beaches in Greece and includes related images in the results. After clicking "Run", both text and image URLs appear in the result cells.

Search excluding specific sites

=TASK_SEARCH("Product Reviews", "best wireless headphones", 8, true, false, false, "", "amazon.com,ebay.com")

This searches for wireless headphone reviews while excluding results from Amazon and eBay.

Best Practices

  • Be specific with your search queries to get more relevant results
  • Use advanced_search_depth=true for research that requires more thorough results
  • Remember to click "Run" in the Sheet Workflows sidebar after entering the formula
  • Keep max_results reasonable (5-10) to avoid cluttering your spreadsheet
  • Use domain filtering to focus on reliable sources for academic or professional research
  • Place the TASK_SEARCH formula in a cell with empty cells to its right to make room for the results table
  • Consider using multiple TASK_SEARCH functions with different parameters to compare results
  • For image-heavy searches, always set include_images=true to get relevant visual content
  • Ensure your Tavily API key is properly configured in the Sheet Workflows settings

Troubleshooting

Error: "Tavily API key is not set in the configuration"

Cause: The Tavily API key has not been added to your Sheet Workflows configuration.
Solution: Go to the Sheet Workflows sidebar, click on "Configure", and add your Tavily API key in the API configuration section.

Error: "Invalid JSON format"

Cause: There may be a syntax error in your formula parameters.
Solution: Check your formula syntax, especially quotes and commas, and ensure all parameters have the correct data type.

No results appearing after clicking "Run"

Cause: The query may be too specific or the search service might be experiencing issues.
Solution: Try a more general query or check your internet connection. Verify that your Tavily API key is valid.

Results not appearing in the expected location

Cause: There may be data in the cells where the results should appear.
Solution: Make sure there are empty cells to the right of your TASK_SEARCH formula cell.

Images not showing up in results

Cause: The include_images parameter is set to false or no relevant images were found.
Solution: Set include_images to true and ensure your query is likely to have image results.

Domain filtering not working

Cause: The domain format might be incorrect.
Solution: Use just the domain name (e.g., "example.com") without "http://" or "www." prefixes.

FAQ

How do I set up my Tavily API key?

To use TASK_SEARCH, you need to sign up for a Tavily API key and add it to Sheet Workflows. Go to the Sheet Workflows sidebar, select "Configure", then add Tavily as a provider with your API key.

Is there a limit to how many searches I can run?

The number of searches is limited by your Tavily API plan. Check your Tavily account for usage limits and pricing.

Can I save or export the search results?

Yes, since results are written directly to your spreadsheet, you can use standard Google Sheets features to save, export, or further process the data.

How current are the search results?

The results reflect what's available on the web at the time of your search. For time-sensitive information, you might want to re-run the search periodically.

Can I format the results after they appear?

Yes, once the results are in your spreadsheet, you can format them like any other cells, add conditional formatting, or create charts based on them.

What happens if I change the parameters after running the search?

You'll need to click "Run" again to execute the search with the new parameters. The previous results will be overwritten when the new search is executed.

Can I run multiple searches at the same time?

Yes, you can have multiple TASK_SEARCH formulas in different cells. However, be aware of your API usage limits.

Why is "advanced_search_depth" slower?

Advanced search depth performs a more thorough search across multiple sources, which requires more processing time but provides more comprehensive results.

Will the search results update automatically?

No, search results are static after they're retrieved. To get fresh results, you'll need to click "Run" again.

Can I search for content in languages other than English?

Yes, you can enter queries in other languages to find content in those languages. The Tavily search API supports multiple languages.

Elisha

1 week ago

Categories
Features