{"id":2649,"date":"2017-03-01T11:38:48","date_gmt":"2017-03-01T14:38:48","guid":{"rendered":"https:\/\/importsheet.com\/?p=2649"},"modified":"2017-03-01T11:38:48","modified_gmt":"2017-03-01T14:38:48","slug":"importhtml-formula-google-sheets","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/pt\/blog\/google-sheets-formulas\/importhtml-formula-google-sheets\/","title":{"rendered":"Como usar a f\u00f3rmula IMPORTHTML do Planilhas Google"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; module_class=&#8221;sheetgo-post&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>If you want to<span>\u00a0<\/span>pull online data into Google Sheets from a website,<span>\u00a0<\/span><a href=\"https:\/\/support.google.com\/docs\/answer\/3093339?hl=en\" target=\"_blank\" rel=\"noopener noreferrer\">IMPORTHTML<\/a>\u00a0Google Sheets formula is a great tool to have up your sleeve. It imports data from a <strong>table<\/strong> or <strong>list<\/strong> on any webpage without you having to copy-paste or adjust the data using other formulas.<\/p>\n<p>Copy-pasting tabular data from the internet into a spreadsheet can generate formatting issues. For this reason, IMPORTHTML is an easier way to import data from sites like Wikipedia directly into your spreadsheet while retaining the correct layout. In addition, this formula ensures your data is always <strong>up-to-date<\/strong>. Google Sheets updates in real time, pulling live data directly into your spreadsheet. When the website is updated, your Google Sheet is updated automatically too. Here&#8217;s how to use the formula.<\/p>\n<h3>Syntax<\/h3>\n<p><span><strong>IMPORTHTML(url, query, index)<\/strong><\/span><\/p>\n<ul>\n<li><span><strong>url<\/strong><\/span><span>\u00a0<\/span>\u2013 this is the address (uniform resource locator) of the web page containing the table or list you want to import.\u00a0This can take two forms.\n<ul>\n<li>A valid and fully qualified location in the form of text (enclosed in double quotes). For example:<span>\u00a0<\/span><strong>\u201chttps:\/\/en.wikipedia.org\/wiki\/Demographics_of_the_world\u201d<\/strong><\/li>\n<li>Or it can be a reference to a cell (such as<span>\u00a0<\/span><strong>B1<\/strong>) within Google Sheets, where the url is stored.<\/li>\n<\/ul>\n<\/li>\n<li><span><strong>query<\/strong><\/span><span>\u00a0<\/span>\u2013 this will be either \u201clist\u201d or \u201ctable\u201d depending upon the structure of the data.<\/li>\n<li><strong><span>index<\/span><\/strong><span>\u00a0<\/span>\u2013 the index number identifies the list or table within the web page. Note that the indexes for lists and tables are treated separately. Both a table and list can exist with same index number.<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3>How to import data from a webpage into Google Sheets<\/h3>\n<h5>Option 1: IMPORTHTML(url, \u201ctable\u201d, index)<\/h5>\n<p>Take a look at the screenshot below. I want to import data into cell B3, so this is where I enter my IMPORTHTML formula.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/importhtml-google-sheets-1.png&#8221; alt=&#8221;importhtml google sheets 1&#8243; title_text=&#8221;importhtml google sheets 1&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span>Make sure that the\u00a0<\/span>url\u00a0is valid, i.e. enclose the url<span>\u00a0with\u00a0<\/span><strong>double quotes<\/strong><span>\u00a0and\u00a0hit\u00a0<\/span><strong>Enter<\/strong><span>.<\/span><\/p>\n<p><span>While Google Sheets fetches the table data, it displays a <strong>Loading<\/strong> notification. Wait a few moments. The bigger the table, the longer it might take to finish the data import.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/importhtml2.png&#8221; alt=&#8221;Importhtml Google Sheets: Loading Data&#8221; title_text=&#8221;importhtml-data-loading&#8221; align=&#8221;center&#8221; module_class=&#8221;sheetgo-post-no-shadow-img&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span>While the data import is in progress, cell B3 looks like it has returned an error. See the little red speck on the top right hand corner of the cell. However, it isn\u2019t an error, just a\u00a0<\/span><strong>transient state<\/strong><span>. Hover the mouse over the cell to see the following description:<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/importhtml3.png&#8221; alt=&#8221;Importhtml Google Sheets: Snapshot of Error&#8221; title_text=&#8221;error-message&#8221; align=&#8221;center&#8221; module_class=&#8221;sheetgo-post-no-shadow-img&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span>As soon as Google Sheets has finished loading the data, the red speck disappears. You\u2019ll notice the data extends from the formula cell (B3) to the right and further down the spreadsheet.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/importhtml-google-sheets-4.png&#8221; alt=&#8221;importhtml google sheets 4&#8243; title_text=&#8221;importhtml google sheets 4&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span>Make sure you leave enough room in the spreadsheet for the entire table of data. If you don&#8217;t, IMPORTHTML formula might cough up a #REF! error. Take a look at the following image to see what happens when I have data in cell\u00a0C9.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/importhtml-google-sheets-5.png&#8221; alt=&#8221;importhtml google sheets 5&#8243; title_text=&#8221;importhtml google sheets 5&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h5>Option 2: IMPORTHTML(url cell reference, \u201clist\u201d, index)<\/h5>\n<p>In this example, I have stored the url in cell B1. This is the<span>\u00a0<\/span><strong>url<\/strong><span>\u00a0<\/span>to the HTML page containing the list we want to import. I\u2019ll refer to that cell in the IMPORTHTML Google Sheets formula, which I enter into cell B3. The result is the same except this time I want a list instead of a table.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/importhtml-google-sheets-6.png&#8221; alt=&#8221;importhtml google sheets 6&#8243; title_text=&#8221;importhtml google sheets 6&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span>Looking for more timesaving formulas and tricks in Google Sheets? If you regularly need to import data from from\u00a0<\/span>.csv or .tsv files from the web<span>, check out the following\u00a0<\/span><a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-formulas\/importdata-formula-google-sheets\/\" target=\"_blank\" rel=\"noopener noreferrer\">how to use the IMPORTDATA formula in Google Sheets.<\/a><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to\u00a0pull online data into Google Sheets from a website,\u00a0IMPORTHTML\u00a0Google Sheets formula is a great tool to have up your sleeve. It imports data from a table or list on any webpage without you having to copy-paste or adjust the data using other formulas. Copy-pasting tabular data from the internet into a spreadsheet [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":4230,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"on","_et_pb_old_content":"If we need to pull data into Google Sheets from a table or a list on an HTML page, <a href=\"https:\/\/support.google.com\/docs\/answer\/3093339?hl=en\">IMPORTHTML<\/a> formula is the one to go with.\n<h3>Syntax<\/h3>\n<span style=\"font-family: courier new,courier,monospace; font-size: 14pt;\"><strong>IMPORTHTML(url, query, index)<\/strong><\/span>\n<ul>\n \t<li><span style=\"font-size: 12pt; font-family: courier new,courier,monospace;\"><strong>url<\/strong><\/span> - this is the address (uniform resource locator) to the HTML page on the web, where the table or list that we are looking to import are located.\u00a0This can take two forms.\n<ul>\n \t<li>A valid and fully qualified location in the form of text (enclosed in double quotes). For example: <strong>\u201chttps:\/\/en.wikipedia.org\/wiki\/Demographics_of_the_world\u201d<\/strong><\/li>\n \t<li>Or it can be a reference to a cell (like <strong>B1<\/strong>) within Google Sheets, where the url is stored.<\/li>\n<\/ul>\n<\/li>\n \t<li><span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>query<\/strong><\/span> - this will be either \"list\" or \"table\" depending upon which HTML structure contains the data we are trying to import.<\/li>\n \t<li><strong><span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\">index<\/span><\/strong> - the index number that identifies the list or table within the HTML page. Please note that the indexes for both lists and tables are treated separately. Both a table and list can exist with same index number.<\/li>\n<\/ul>\n<h3>Usage: IMPORTHTML Formula<\/h3>\n<h5>Case # 1: IMPORTHTML(url, \"table\", index)<\/h5>\nIn the\u00a0snapshot below, we are trying to import the data into the cell B3, which therefore becomes the destination to key in the IMPORTHTML formula.\n\n<img class=\"aligncenter size-full wp-image-2652\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/importhtml1.png\" alt=\"IMPORTHTML Formula - Illustration 1\" width=\"756\" height=\"391\" \/>\n\nWe ensure the <span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>url<\/strong><\/span>\u00a0is valid, i.e. enclose <span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>url<\/strong><\/span> within double quotes and\u00a0hit the Enter key. Below\u00a0is what we see as Google Sheets tries to fetch the table data. Bigger the table, the longer it might take to finish the data import.\n\n<img class=\"aligncenter size-full wp-image-2653\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/importhtml2.png\" alt=\"IMPORTHTML Formula - Illustration 2\" width=\"555\" height=\"134\" \/>\n\nWhile the data import is in progress, the cell in which we keyed in the formula, looks like it\u00a0returned an error. Please note a little red speck on the top right corner of the cell. But, it isn\u2019t an error, just a transient state. Hover the mouse on the cell, to see the following description.\n\n<img class=\"aligncenter size-full wp-image-2654\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/importhtml3.png\" alt=\"IMPORTHTML Formula - Illustration 3\" width=\"656\" height=\"182\" \/>\n\nAs soon as Google Sheets loads the data, the red speck disappears. You\u2019ll notice the data extends from the formula cell (B3) to right and also further down.\n\n<img class=\"aligncenter size-full wp-image-2655\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/importhtml4.png\" alt=\"IMPORTHTML Formula - Illustration 4\" width=\"856\" height=\"326\" \/>\n\nSo, it is of utmost importance that we keep the expected real estate of the result,\u00a0clear of any preoccupied values. Otherwise, IMPORTHTML formula might cough up a #REF! error. For example, following image explains what could happen, if we had any values, for instance, in cell\u00a0C9.\n\n<img class=\"aligncenter size-full wp-image-2656\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/importhtml5.png\" alt=\"IMPORTHTML Formula - Illustration 5\" width=\"656\" height=\"244\" \/>\n<h5>Case # 2: IMPORTDATA(url cell reference, \"list\", index)<\/h5>\nHere, in the cell B1, we have stored the <strong>url<\/strong> to the HTML page from which we are trying to import a list. So, we\u2019ll use that cell to refer in the IMPORTHTML formula. And, the result is same as that of\u00a0the first case. Except, now the result is a list instead of a table.\n\n<img class=\"aligncenter size-full wp-image-2657\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/importhtml6.png\" alt=\"IMPORTHTML Formula - Illustration 6\" width=\"647\" height=\"559\" \/>","_et_gb_content_width":"","footnotes":""},"categories":[54],"tags":[39,28],"class_list":["post-2649","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google-sheets-formulas","tag-connections-t","tag-spreadsheets"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/2649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/comments?post=2649"}],"version-history":[{"count":0,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/2649\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media\/4230"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media?parent=2649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/categories?post=2649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/tags?post=2649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}