Scrape Website Data to Google Sheets

preview_player
Показать описание

Reg Expression Tool:
Рекомендации по теме
Комментарии
Автор

Reg Expression is a very complex subject. Very good video!

JerryEduardo
Автор

Google Apps Script Code used in Video Below:

function mainFunction()
{
//
// CODE WITH CURT 2/14/2021
// The code below will eventually not bring back the desired results.
// Over time Web sites get Updated and Upgraded losing the original HTML and CSS tags that
// are searched in the RegExp statements.
//

clearRecords();


var str =

const mainRegex = /<td class=\"team\"
var results = str.match(mainRegex);

const teamNamePass1 = /<span
const teamNamePass2 = /(?<=<span

const teamLogoPass = /(?<=img class=\"badge-image badge-image--25\" src=\").*?(?=\")/gi;

for(var i = 0; i < 20; i++)
{
Logger.log('content: ' + results[i]);
var team1NameString =
Logger.log('content: ' + team1NameString[0]);
var team2NameString =
Logger.log('content: ' + team2NameString[0]);

var team1Logo =
Logger.log('content: ' + team1Logo[0]);

addRecord(i+1, team2NameString[0], team1Logo[0]);
}
}

function clearRecords()
{
var ss=
var tableSheet = ss.getSheetByName("TABLE");


var images = tableSheet.getImages();
for (var i = 0; i < images.length; i++)
{
var img = images[i];
img.remove();
}
}


function addRecord(count, team, logo) {
var ss=
var tableSheet = ss.getSheetByName("TABLE");
var currentRow = tableSheet.getLastRow();
var nextRow = currentRow + 1;
tableSheet.setRowHeight(nextRow, 30);
tableSheet.getRange(nextRow, 1).setValue(count);
tableSheet.insertImage(logo, 2, nextRow);
tableSheet.getRange(nextRow, 3).setValue(team);
tableSheet.getRange(nextRow, 4).setValue(new Date());

}

CodeWithCurt
Автор

What an amazing video, Plus I am doing this while my team Arsenal is at the top #1💪💪 I like it.😁🤣🤣

ohbbdko
Автор

Hi @Code With Curt: Any limitation on the total query number by Google?

phunghm
Автор

Is that works with website that do not support API? The website that can proceed importHTML or importXML and Eror result for the cell. Need Help!

EMILSEPTIANDRI
Автор

What should i do if there is no class?

BrodieTheAthlete
Автор

what if you dont know the url?. can you webscrap image url?

ROMERBATISTA
Автор

Do you do freelance tasks?
I need your booking script with some minor paid modification. Kindly reply if you are interested.
Thank you.

abdullahquhtani
Автор

Hi I try to adapt your scraping for mine but don't fit enough may i ask U one help to pick the data of this span on a google sheet ?

<span class="MuiTypography-root MuiTypography-span css-1o17n88">23.90</span>

thx

adrienfp
Автор

What if I have to pass cookies from previous request to next requests?? 😢

rs-tarxvfz
Автор

I want to learn google sheet scripts, how sujjest me

BusinessBananaShikhe
Автор

How to add please wait loading on a web app while loading in iframe

Please help me

My webpage is still blank untill the webapp loads in my webpage
I wanto add please wait untill it loads

namichand