Takes a full-page picture of each page you list, reads the details you asked for off the picture, and adds a row per page to your sheet.
Uses
Google Sheets
OpenAI
ScreenshotOne
Read details off web pages that won't share their text
Every Monday at 07:00, a full-page picture is taken of each web address you list, with adverts and cookie banners hidden, the details you asked for are read off the picture itself, and one row per page is added to your Google Sheet. It suits pages where a plain fetch gets nothing useful.
Each row carries the date, the page address, one cell per detail you asked for and a note. Every page you list gets exactly one row, including the ones that go wrong: a bad address, a page that could not be photographed or a picture with none of your details each produce a row with the detail cells empty and the reason in the note, so an empty cell never looks like a successful read. Nothing is guessed: only what is legible in the picture is written. Rows are only ever appended, so nothing already on the tab is edited or removed.
Before the first run your tab needs a header row of 'Captured on', 'Page', your own field names in the order you list them, then 'Note'.
pageUrls to blank.Set pageUrls to blank.fieldsToRead to blank.Set fieldsToRead to blank.spreadsheetUrl to blank.Set spreadsheetUrl to blank.sheetName to blank.Set sheetName to blank.maxPages to 10.Set maxPages to 10.fieldNames to an empty list.Set fieldNames to an empty list.rawFieldName in fieldsToRead split by ,:For each rawFieldName in fieldsToRead split by ,:rawFieldName and save it as fieldName.Trim rawFieldName and save it as fieldName.fieldName isn't emptyIf fieldName isn't emptyfieldName to the end of fieldNames and save it as fieldNames.Add fieldName to the end of fieldNames and save it as fieldNames.fieldNames is emptyIf fieldNames is emptyblankCells to an empty list.Set blankCells to an empty list.unreadFieldName in fieldNames:For each unreadFieldName in fieldNames: to the end of blankCells and save it as blankCells.Add to the end of blankCells and save it as blankCells.capturedOn.Get today's date and save it as capturedOn.pagesCaptured to 0.Set pagesCaptured to 0.rowsWritten to 0.Set rowsWritten to 0.rawPageUrl in pageUrls with "For each rawPageUrl in pageUrls with
replaced by , split by ,:rawPageUrl and save it as pageUrl.Trim rawPageUrl and save it as pageUrl.pageUrl is emptyIf pageUrl is emptypagesCaptured is greater than or equal to maxPages multiplied by 1If pagesCaptured is greater than or equal to maxPages multiplied by 1pagesCaptured.Add 1 to pagesCaptured.problemNote to blank.Set problemNote to blank.pictureRef to blank.Set pictureRef to blank.pageUrl doesn't start with https:// and pageUrl doesn't start with http://If pageUrl doesn't start with https:// and pageUrl doesn't start with http://problemNote to This is not a web address. Give the page as a full address starting with https://..Change problemNote to This is not a web address. Give the page as a full address starting with https://..captureErrorIf a step below fails, save the error as captureErrorpictureRef.Trim the document ref from the ScreenshotOne “Take a screenshot” step and save it as pictureRef.pageUrl: captureError as text.Show in the output: Could not photograph pageUrl: captureError as text.pictureRef to blank.Change pictureRef to blank.pictureRef doesn't start with doc_If pictureRef doesn't start with doc_problemNote to No picture of this page could be taken. Check the address opens in a browser without signing in..Change problemNote to No picture of this page could be taken. Check the address opens in a browser without signing in..readFields to an empty list.Set readFields to an empty list.problemNote is emptyIf problemNote is emptyreadErrorIf a step below fails, save the error as readErrorpictureReading.Run an AI agent: Read the attached picture of a web page and pull out each of these fields, in this order:… and save it as pictureReading.readFields to pictureReading.output.fields.Change readFields to pictureReading.output.fields.pageUrl: readError as text.Show in the output: Could not read the picture of pageUrl: readError as text.readFields to an empty list.Change readFields to an empty list.problemNote to The picture was taken but nothing could be read off it..Change problemNote to The picture was taken but nothing could be read off it..rowValues to [capturedOn, pageUrl].Set rowValues to [capturedOn, pageUrl].filledCells to 0.Set filledCells to 0.wantedField in fieldNames:For each wantedField in fieldNames:cellValue to blank.Set cellValue to blank.readField in readFields:For each readField in readFields:readFieldName to blank.Set readFieldName to blank.unnamedFieldIf a step below fails, save the error as unnamedFieldreadField.name and save it as readFieldName.Trim readField.name and save it as readFieldName.readFieldName to blank.Change readFieldName to blank.readFieldName is wantedFieldIf readFieldName is wantedFieldvalueIsAListIf a step below fails, save the error as valueIsAListreadField.value and save it as cellValue.Trim readField.value and save it as cellValue.readField.value with , and save it as cellValue.Join readField.value with , and save it as cellValue.cellValue isn't emptyIf cellValue isn't emptyfilledCells.Add 1 to filledCells.cellValue to the end of rowValues and save it as rowValues.Add cellValue to the end of rowValues and save it as rowValues.problemNote is empty and filledCells is 0If problemNote is empty and filledCells is 0problemNote to The picture was read but none of the details you asked for are on this page..Change problemNote to The picture was read but none of the details you asked for are on this page..problemNote to the end of rowValues and save it as rowValues.Add problemNote to the end of rowValues and save it as rowValues.sheetName in spreadsheetUrl.Add a row to sheetName in spreadsheetUrl.rowsWritten.Add 1 to rowsWritten.rowsWritten as text of pagesCaptured as text pages looked at.Show in the output: Rows written: rowsWritten as text of pagesCaptured as text pages looked at.