Yaniv Aflalo
Yaniv Aflalo

Reputation: 249

How to import full html code to Google Sheets

Background

I need to import multiple data values from a URL (always the same data values to import, URL can change - user inserts whatever URL she/he needs).

Problem

Possible Solution

To have the entire html code of a URL as a string in a single cell and then query this string using =REGEXMATCH() to find what I need.

The advantage would be that this can allow me to access the URL only once and then do the checks localy, which will make it much faster.

Expectation

<html>
  <head>
  ... <!-- all children -->
  </head>
  <body>
  ... <!-- all children -->
  </body>
</html>

(in a one/several cells)

What I've tried

I tried using =IMPORTXML(URL,"//html"), but it does not import the actual tags (that are required in this case for context).

Is there another way?

Upvotes: 0

Views: 2332

Answers (1)

Krzysztof Dołęgowski
Krzysztof Dołęgowski

Reputation: 2660

You can display all the URL data using IMPORTDATA("url") In most cases I suggest limiting this using query or array_constrain as website content may be very long.

Reference:

Upvotes: 2

Related Questions