I am trying to pull the table from specific URL
Using: IMPORTHTML("https://URLNAME","table",1)
But I get the error: "Error Resource at url contents exceeded maximum size".
Can I bypass this issue by writing a custom script?
I am trying to pull the table from specific URL
Using: IMPORTHTML("https://URLNAME","table",1)
But I get the error: "Error Resource at url contents exceeded maximum size".
Can I bypass this issue by writing a custom script?
Here is a better way to retrieve data from html table
function importTableHTML(url) {
var html = '<table' + UrlFetchApp.fetch(url).getContentText().match(/(?<=\<table).*(?=\<\/table)/g) + '</table>';
var trs = [...html.matchAll(/<tr[\s\S\w]+?<\/tr>/g)];
var data = [];
for (var i=0;i<trs.length;i++){
var tds = [...trs[i][0].matchAll(/<(td|th)[\s\S\w]+?<\/(td|th)>/g)];
var prov = [];
for (var j=0;j<tds.length;j++){
donnee=tds[j][0].match(/(?<=\>).*(?=\<\/)/g)[0].replace(/ /g,' ');
if(donnee.indexOf("</a>")>-1){
prov.push(donnee.match(/(?<=\>).*(?=\<\/)/g)[0]);
}else{
prov.push(donnee);
}
}
data.push(prov);
}
return(data);
}