Scrape PARTS of an email to add to GSheets

I have a label set up in Gmail to match incoming filter. I need a new row to be created in a specified GSheet each time an email hits the inbox that matches the filter. I don’t need the whole body of the email to be added, I needed certain elements only to be added to specific rows in my GSheet.

I was able to create a scraper to collect the parts of the email to add appropriately via right-click if I’m on the active tab.

Now, I’m trying to set it up to also run in the background using that scrape model.
I thought maybe trigger could be “when receive email from @” then scrape data in the background… using scraper template… then add row to GSheets.
I’ve mapped my GSheets out, but where the trigger is failing is somewhere in the "Scrape from the _____ of “when email is received”…

How would I fix that?

Here is the autobook that is set up: Shared Playbook | Bardeen

Here is the error code:
{
“clientErrorCode”: “ScraperMissingTargetPageError”,
“message”: “You did not select a page on which to run this Automation.”,
“trackError”: false,
“stack”: “Error: You did not select a page on which to run this Automation.\n at i.from (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/background.js:83:13923)\n at Object.from (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/background.js:90:4724)\n at WM.handle (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1369:23967)\n at async chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:89761\n at async pS.guard (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:71538)\n at async Gw.invokeFunction (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:89719)\n at async Gw.invokeSequence (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:80769)\n at async Gw.invokePlaybook (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:82321)\n at async Lf.execute (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:100219)\n at async Lf.executeWithResult (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:100748)”,
“clientErrorHistory”: [
{
“clientErrorCode”: “ScraperMissingTargetPageError”,
“message”: “You did not select a page on which to run this Automation.”,
“stack”: “Error: You did not select a page on which to run this Automation.\n at i.from (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/background.js:83:13923)\n at Object.from (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/background.js:90:4724)\n at WM.handle (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1369:23967)\n at async chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:89761\n at async pS.guard (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:71538)\n at async Gw.invokeFunction (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:89719)\n at async Gw.invokeSequence (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:80769)\n at async Gw.invokePlaybook (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:82321)\n at async Lf.execute (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:100219)\n at async Lf.executeWithResult (chrome-extension://ihhkmalpkhkoedlmcnilbbhhbhnicjga/348.js:1464:100748)”,
“fingerprint”: [
“ScraperMissingTargetPageError”
]
}
],
“fingerprint”: [
“ScraperMissingTargetPageError”
]

Hi @jamiemilam, the error is being returned because the Scrape data in the background action doesn’t have a URL to run the scraper template from as you’ve selected the body output of the email for this input:

To correct, this try using the permalink selection from the “When an Email is received” action:

I believe this should fix your automation. Please don’t hesitate to reach out if any issues persist.

Thank you,
Jess

Thanks Jess. It did work but it failed to pull two elements (which work when I do the right click method)… the structure of that email is the same every time it comes in from that sender, so any idea why it wouldn’t have scraped those two elements?

Thank you for the update.

This is likely an issue with your scraper template, we probably need to further define the selectors.

Unfortunately, Bardeen doesn’t allow other users to edit shared scraper templates at this time so I’m unable to do it for you.

But to investigate what’s needed on my end, Could you please provide the link to one of your emails? I’m not sure if just the link will work so could you also forward to my Gmail at jessie.vanwyhe@gmail.com?

Also, please advise which elements are not pulling in. Thank you!

Yep, I just forwarded you the email and included the two elements that didn’t transfer

1 Like

Thank you, I am getting the results for this one on my end.

Could you please re-share the automation with the new version? and also share your GSheet publically (with edit rights)?

I’ll see if I can dig in further to see what’s going on. Thank you!

new automation: Shared Playbook | Bardeen

Thanks, it appears this is still the first version of the automation. You have to stop sharing and then reshare it to get the newest version.

I also need the shared GSheet publically (with edit rights). Thank you!

1 Like

Sorry @jamiemilam, I’m not seeing a response here?

Autobook: https://bardeen.ai/s/TgZVGEVDAxgT

The GSheet link is available to edit if you have the link

All the best,
Jamie

photo
Logo

JAMIE MILAM
Realtor® NC/SC
Team Leader

P 704-426-3885
E JamieMilam@kw.com
W OrendaHomeGroup.com

5925 Carnegie Blvd, Suite 250, Charlotte, NC 28209

facebookinstagramyoutube

logo Download My App kw

banner

Hi @jamiemilam,

I was able to get the same results you are on my end now. I know it’s your scraper template we need to update, but I need to be able to get the exact selectors for you in the same way that the email is sent.

For me to do this, could you please send the email you are trying to scrape from as an attachment to me?

Thank you,
Jess

Here it is in PDF and link form

https://share.streak.com/ZS1q7HP084jHfWo5830kHB

Does that work?

(Attachment book lead email.pdf is missing)

That won’t work because we need it in the exact html structure that it will be sent in as that’s what the scraper model will run on each time.

So when you say “as an attachment” what do you mean?
Do you just need me to forward you the email?

Like this:

I sent you the example too.

Ok, I think i got it… i sent back to your other email

1 Like

Okay so now let’s try editing your scraper template selectors for the values that aren’t populating:

Fname:

#\:1op > div:nth-child(2) > table.m_-837536536411230267body-wrap > tbody > tr > td.m_-837536536411230267container > div > table > tbody > tr > td > table > tbody > tr:nth-child(1) > td:nth-child(2)

Booksource:

#\:1op > div:nth-child(2) > table.m_-837536536411230267body-wrap > tbody > tr > td.m_-837536536411230267container > div > table > tbody > tr > td > table > tbody > tr:nth-child(5) > td:nth-child(2)

To do this:

  1. Open the edit screen of your scraper template
  2. Select Edit on the Fname value:
  3. Hit show advanced options
  4. Delete all of the pre-generated selectors:
  5. Click Add permutation
  6. Remove the pre-populated “tagname.className” text and C&P the above into each value:
  7. Hit save.

Rerun your automation and observe the results. I hope this helps!

Thank you - Am I only deleting the FName and Booksource values since those are the two not populating? Also, the screenshots you show are what it looked like when I was first building the scraper. It seems to look different from the “Open in Builder” option. Do I need to start from the beginning to get the permutation option?

Yes, if the others start not populating, we can get you the selectors for those too.

The screenshots are different from the “Open the builder” view as this is from the edit scraper template view. You do no need to create the scraper template from scratch in order to add the permutations.

Have you tried to rerun it after the above updates? Any luck?