Reads each company in your sheet from its own web page and records what it sells and who to, with the page it read.
Uses
Claude
Google Sheets
Jina AI
Serper
Fill in what each company sells, and who to
Every day, the next few companies in your Google Sheet are taken in turn, each one's own web page is found and read, and what that page says the company sells and who it sells to is recorded on a separate tab. Companies already on the results tab are skipped, so it picks up where it left off and your list itself is never overwritten.
Each result row holds whether the company sells to businesses, consumers or both, the phrase from the page that supports that, the industry, who they serve, what they offer, and the address of the page read. These are observations, not verdicts: nothing comes from what the AI already knows about a company, so if the page does not say something that cell is left empty, and a company with no readable page gets a row with every research column blank and a note saying so.
Before the first run you need a tab named 'Companies' with a 'Company' column and optionally a 'Website' column, and a tab named 'Company research' for the results.
sheetUrl to blank.Set sheetUrl to blank.companiesTab to Companies.Set companiesTab to Companies.researchTab to Company research.Set researchTab to Company research.maxCompaniesPerRun to 10.Set maxCompaniesPerRun to 10.checkedOn.Get today's date and save it as checkedOn.alreadyResearched.Start an empty list and save it as alreadyResearched.researchTabErrorIf a step below fails, save the error as researchTabErrorsheetUrl. Save it as done.Read the rows of sheetUrl. Save it as done.doneRow in done.rows:For each doneRow in done.rows:doneRow.Company and save it as doneName. Trim doneRow.Company and save it as doneName.doneName isn't empty and doneName is not null If doneName isn't empty and doneName is not nulldoneName to the end of alreadyResearched and save it as alreadyResearched.Add doneName to the end of alreadyResearched and save it as alreadyResearched.Could not read the 'Company research' tab, so this run treated it as empty. If that tab does not exist yet, create it..Show in the output: Could not read the 'Company research' tab, so this run treated it as empty. If that tab does not exist yet, create it..sheetUrl. Save it as source.Read the rows of sheetUrl. Save it as source.researched to 0.Set researched to 0.row in source.rows:For each row in source.rows:researched multiplied by 1 is greater than or equal to maxCompaniesPerRunโฆIf researched multiplied by 1 is greater than or equal to maxCompaniesPerRunโฆrow.Company and save it as company.Trim row.Company and save it as company.company is empty or company is nullIf company is empty or company is nullalreadyResearched contains companyIf alreadyResearched contains companyresearched.Add 1 to researched.companyErrorIf a step below fails, save the error as companyErrorrow.Website and save it as siteFromSheet.Trim row.Website and save it as siteFromSheet.pageUrl to blank.Set pageUrl to blank.siteFromSheet in lowercase starts with https://If siteFromSheet in lowercase starts with https://pageUrl to siteFromSheet.Change pageUrl to siteFromSheet.pageUrl is emptyIf pageUrl is emptyfound.Search Google for '@company official website'. Save it as found.result in found.results:For each result in found.results:pageUrl is empty If pageUrl is emptyresult.link and save it as link.Trim result.link and save it as link.link in lowercase starts with https://If link in lowercase starts with https://pageUrl to link.Change pageUrl to link.pageUrl is emptyIf pageUrl is emptyresearchTab in sheetUrl.Add a row to researchTab in sheetUrl.pageUrl with Jina. Save it as page.Read the page at pageUrl with Jina. Save it as page.page.content and save it as pageText.Trim page.content and save it as pageText.pageText is less than 200If the length of pageText is less than 200researchTab in sheetUrl.Add a row to researchTab in sheetUrl.pageSection to PAGE TEXT - this is the only material you may use:Set pageSection to PAGE TEXT - this is the only material you may use:
pageText truncated to 12000 characters.askSection to COMPANY: companySet askSection to COMPANY: company
PAGE ADDRESS: pageUrl.prompt to You are recording what one company's own web page says about itself. You have the text of a single page and nothing else.Set prompt to You are recording what one company's own web page says about itself. You have the text of a single page and nothing else.
Answer with EXACTLY five values separated by ||| and nothing else - no labels, no numbering, no preamble.
1. Whether the page describes selling to businesses, to consumers, or to both. Reply with exactly one of: B2B, B2C, Both.
2. A short phrase copied from the page that shows why - the words the page itself uses about who it sells to.
3. The industry the page describes the company as working in, in the page's own terms.
4. Who the page says the company is for - the kind of customer it names.
5. What the page says the company offers those customers.
Rules you must follow:
- Use only the page text below. Do not use anything you know about this company from anywhere else, and do not infer a value from the company's name or its web address.
- If the page does not say something, write exactly NOT STATED for that value. A blank is a correct answer; a plausible guess is not.
- Report what the page says, not a judgement about it. Do not describe the company as successful, reputable, established, large or small.
askSection
pageSection.prompt. Save it as reply.Ask Claude: prompt. Save it as reply.
Maximum response length: 600reply.response_text and save it as answer.Trim reply.response_text and save it as answer.answer by ||| and save it as parts.Split answer by ||| and save it as parts.parts is less than 5If the length of parts is less than 5researchTab in sheetUrl.Add a row to researchTab in sheetUrl.parts[0] and save it as sellsTo.Trim parts[0] and save it as sellsTo.sellsTo is null or sellsTo in lowercase is not statedIf sellsTo is null or sellsTo in lowercase is not statedsellsTo to blank.Change sellsTo to blank.parts[1] and save it as evidence.Trim parts[1] and save it as evidence.evidence is null or evidence in lowercase is not statedIf evidence is null or evidence in lowercase is not statedevidence to blank.Change evidence to blank.parts[2] and save it as industry.Trim parts[2] and save it as industry.industry is null or industry in lowercase is not statedIf industry is null or industry in lowercase is not statedindustry to blank.Change industry to blank.parts[3] and save it as serves.Trim parts[3] and save it as serves.serves is null or serves in lowercase is not statedIf serves is null or serves in lowercase is not statedserves to blank.Change serves to blank.parts[4] and save it as offers.Trim parts[4] and save it as offers.offers is null or offers in lowercase is not statedIf offers is null or offers in lowercase is not statedoffers to blank.Change offers to blank.researchTab in sheetUrl.Add a row to researchTab in sheetUrl.company this time; it will be tried again on the next run.Show in the output: Could not research company this time; it will be tried again on the next run.