Reputation: 541
My IMPORTXML functions sometimes work, but sometimes don't. When they don't, I get the following error:
Resource at url contents exceeded maximum size.
I tried downloading the website, and then hosting only the HTML at a domain that I own. When I do this, I am able to import using IMPORTXML, but my data obviously won't update automatically.
Is there a way to overcome this by somehow forcing the IMPORTXML function to only look at the HTML?
Upvotes: 2
Views: 10467
Reputation: 5509
I recommend using a custom function that technically grabs all of it. If it is really a ton of content then wrap the (.*)
with the content that surrounds the real content you want... such as <head>(.*)<\/head>
(just for example sake)
function importWebsite(url) {
var found, html, content = '';
var response = UrlFetchApp.fetch(url);
if (response) {
html = response.getContentText();
if (html) content = html.match(/^(.*)/gi)[0];
}
return content;
}
Upvotes: 1