Runs one product search each week and writes a row per result - price, seller, delivery, rating - to your sheet.
Uses
Google Sheets
Serper
Turn a shopping search into a price sheet
Every week, one shopping search for the product you describe is run for the country you are shopping in, and the results are pulled apart into columns you can sort and chart: the product name, the price as the seller listed it, that price as a number, the seller, the delivery terms, the star rating, the review count and the link.
No AI reads the page and no page is fetched: the shopping search already returns these as separate fields, so every cell is a value the search itself supplied. A field the seller did not publish is left empty rather than guessed, and a result with no product name is skipped and reported. Rows are only ever appended and each run stamps its date in the 'Checked' column, so the weekly schedule builds a price history for the same search rather than replacing last week's figures.
Before the first run you need a Google Sheet with a tab for this search; an empty tab gets its own header row the first time. Use one copy per product you want to track.
searchQuery to blank.Set searchQuery to blank.spreadsheetUrl to blank.Set spreadsheetUrl to blank.sheetName to blank.Set sheetName to blank.countryCode to blank.Set countryCode to blank.maxProducts to 20.Set maxProducts to 20.spreadsheetUrl. Save it as sheet.Read the rows of spreadsheetUrl. Save it as sheet.sheetHeaders to sheet.headers.Set sheetHeaders to sheet.headers.sheetHeaders is emptyIf sheetHeaders is emptysheetName in spreadsheetUrl.Add a row to sheetName in spreadsheetUrl.searchQuery. Save it as search.Search Google Shopping for searchQuery. Save it as search.products to search.products.Set products to search.products.addedCount to 0.Set addedCount to 0.noPriceCount to 0.Set noPriceCount to 0.product in products:For each product in products:addedCount multiplied by 1 is greater than or equal to maxProducts multiplied…If addedCount multiplied by 1 is greater than or equal to maxProducts multiplied…productErrorIf a step below fails, save the error as productErrorproduct.title and save it as productTitle.Trim product.title and save it as productTitle.productTitle is nullIf productTitle is nullproductTitle to blank.Change productTitle to blank.productTitle is emptyIf productTitle is emptySkipped a shopping result that came back without a product name..Show in the output: Skipped a shopping result that came back without a product name..product.price and save it as priceAsListed.Trim product.price and save it as priceAsListed.priceAsListed is nullIf priceAsListed is nullpriceAsListed to blank.Change priceAsListed to blank.product.source and save it as seller.Trim product.source and save it as seller.seller is nullIf seller is nullseller to blank.Change seller to blank.product.delivery and save it as delivery.Trim product.delivery and save it as delivery.delivery is nullIf delivery is nulldelivery to blank.Change delivery to blank.product.rating and save it as rating.Trim product.rating and save it as rating.rating is nullIf rating is nullrating to blank.Change rating to blank.product.rating_count and save it as reviews.Trim product.rating_count and save it as reviews.reviews is nullIf reviews is nullreviews to blank.Change reviews to blank.product.link and save it as link.Trim product.link and save it as link.link is nullIf link is nulllink to blank.Change link to blank.priceValue to blank.Set priceValue to blank.priceAsListed isn't emptyIf priceAsListed isn't emptypriceAsListed and save it as priceValue.Extract the first number from priceAsListed and save it as priceValue.noPriceCount.Add 1 to noPriceCount.sheetName in spreadsheetUrl.Add a row to sheetName in spreadsheetUrl.addedCount.Add 1 to addedCount.productError as text.Show in the output: Skipped a shopping result that could not be read: productError as text.addedCount multiplied by 1 is 0If addedCount multiplied by 1 is 0addedCount as text products to the '@sheetName' tab. noPriceCount as text of them were listed without a price, so their price columns are empty.Show in the output: Wrote addedCount as text products to the '@sheetName' tab. noPriceCount as text of them were listed without a price, so their price columns are empty.