{"id":2649,"date":"2017-03-01T11:38:48","date_gmt":"2017-03-01T14:38:48","guid":{"rendered":"https:\/\/importsheet.com\/?p=2649"},"modified":"2026-11-10T15:34:17","modified_gmt":"2026-11-10T14:34:17","slug":"formule-importhtml-google-sheets","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/fr\/blog\/google-sheets-formulas\/importhtml-formula-google-sheets\/","title":{"rendered":"Comment utiliser la formule IMPORTHTML de Google Sheets ?"},"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\u00a0pull online data into Google Sheets from a website,\u00a0<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 refreshes the formula on its own, so when the website changes, your sheet catches up within about an hour. Here&#8217;s how to use the formula.<\/p>\n<h2>IMPORTHTML syntax<\/h2>\n<p><strong>IMPORTHTML(url, query, index)<\/strong><\/p>\n<ul>\n<li><strong>url<\/strong>\u00a0\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:\u00a0<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\u00a0<strong>B1<\/strong>) within Google Sheets, where the url is stored.<\/li>\n<\/ul>\n<\/li>\n<li><strong>query<\/strong>\u00a0\u2013 this will be either \u201clist\u201d or \u201ctable\u201d depending upon the structure of the data. Use &#8220;table&#8221; for data inside an HTML table (the &lt;table&gt; tag). Use &#8220;list&#8221; for a bulleted or numbered list (the &lt;ul&gt; or &lt;ol&gt; tag).<\/li>\n<li><strong><span>index<\/span><\/strong>\u00a0\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. The count starts at 1, so 1 is the first table (or the first list) in the page&#8217;s HTML.<\/li>\n<\/ul>\n<p>IMPORTHTML returns the table or list starting in the formula cell and fills the cells to the right and below, so leave that area empty. For example, =IMPORTHTML(B1, &#8220;table&#8221;, 2) imports the second table on the page whose URL is in cell B1.<\/p>\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<h2>How to import data from a webpage into Google Sheets<\/h2>\n<h3>Option 1: IMPORTHTML(url, \u201ctable\u201d, index)<\/h3>\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 \u2014 IMPORTHTML formula entered in cell B3&#8243; title_text=&#8221;IMPORTHTML formula entered in cell B3&#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>Make sure that the\u00a0url\u00a0is valid, i.e. enclose the url\u00a0with\u00a0<strong>double quotes<\/strong>\u00a0and\u00a0hit\u00a0<strong>Enter<\/strong>.<\/p>\n<p>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.<\/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>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<strong>transient state<\/strong>. Hover the mouse over the cell to see the following description:<\/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>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.<\/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 \u2014 imported table filling the cells from B3 to the right and down&#8221; title_text=&#8221;Imported table filling the cells from B3 to the right and down&#8221; _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>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.<\/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 \u2014 #REF! error because cell C9 already holds data&#8221; title_text=&#8221;#REF! error because cell C9 already holds data&#8221; _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<h3>Option 2: IMPORTHTML(url cell reference, \u201clist\u201d, index)<\/h3>\n<p>In this example, I have stored the url in cell B1. This is the\u00a0<strong>url<\/strong>\u00a0to 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 \u2014 list imported with the URL stored in cell B1&#8243; title_text=&#8221;List imported with the URL stored in cell B1&#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.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>How to find the index of a table or list<\/h2>\n<p>The index counts tables and lists in the order they appear in the page&#8217;s HTML. Tables and lists are counted separately, and the count starts at 1. On a short page, try 1, 2, 3 and so on until the right data appears.<\/p>\n<p>On a page with many tables or lists, use your browser&#8217;s developer console to see the numbers:<\/p>\n<ol>\n<li>Open the page in Chrome. Press Ctrl + Shift + J on Windows, or Cmd + Option + J on a Mac, to open the Console.<\/li>\n<li>To number the tables, paste this code and press Enter:<br \/><code>var i = 1; document.querySelectorAll(\"table\").forEach(function (el) { console.log(i++, el); });<\/code><\/li>\n<li>Hover over each result in the Console. Chrome highlights that table on the page. The number next to it is the index to use in IMPORTHTML.<\/li>\n<li>For lists, run the same code with &#8220;ul, ol&#8221; in place of &#8220;table&#8221;.<\/li>\n<\/ol>\n<p>The Console shows the page after its scripts have run. If a table appears there but IMPORTHTML can&#8217;t find it, the page probably builds it with JavaScript. See the next section.<\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;google-sheets-importhtml-not-working&#8221; _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>Google Sheets IMPORTHTML not working<\/h2>\n<p>When IMPORTHTML fails, the cell shows an error. Click the cell and hover over the red triangle in its corner to read the message. These are the usual causes.<\/p>\n<h3>#N\/A error: could not fetch the URL<\/h3>\n<p>Google&#8217;s servers fetch the page, not your browser. If the page needs a login, sits on a company network, or blocks automated visitors, the fetch fails. Check the address too. It must start with http:\/\/ or https:\/\/, and the page may have moved since you wrote the formula. To test, open the URL in a private browser window. If you have to sign in there, IMPORTHTML can&#8217;t read the page either.<\/p>\n<h3>The table loads with JavaScript<\/h3>\n<p>IMPORTHTML reads the HTML that the server sends. It doesn&#8217;t run the page&#8217;s scripts. Many sites build their tables with JavaScript after the page loads, so the table you see in your browser isn&#8217;t in that HTML, and IMPORTHTML returns an error saying the imported content is empty. To check, right-click the page, choose View page source, and search for a value from the table. If it isn&#8217;t there, look for a CSV download on the site and import that file with <a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-formulas\/importdata-formula-google-sheets\/\">IMPORTDATA<\/a> instead.<\/p>\n<h3>Wrong data: the index has changed<\/h3>\n<p>If the formula returns a different table than you expected, the index is off. Sites change their layout, and a new table near the top of a page shifts every number after it. Find the index again with the steps above. An index higher than the number of tables or lists on the page returns an error.<\/p>\n<h3>#REF! error: the result would overwrite data<\/h3>\n<p>IMPORTHTML needs empty cells for the whole result. If any cell in that range already holds a value, you get #REF!, as shown in Option 1 above. Clear those cells or move the formula.<\/p>\n<h3>The data doesn&#8217;t refresh<\/h3>\n<p>Google Sheets recalculates IMPORTHTML on its own about every hour, so the cell can lag behind the website. To force a refresh, edit the formula and press Enter.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>Other ways to import data into Google Sheets<\/h2>\n<p>IMPORTHTML only reads tables and lists. Google Sheets has other import functions for other sources:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-formulas\/importxml-formula-google-sheets\/\">IMPORTXML<\/a> pulls any part of a web page or XML file with an XPath query.<\/li>\n<li><a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-formulas\/importrange\/\">IMPORTRANGE<\/a> pulls a range of cells from another Google Sheets file.<\/li>\n<li><a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-formulas\/importfeed-formula-google-sheets\/\">IMPORTFEED<\/a> imports an RSS or Atom feed.<\/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<p>Looking for more timesaving formulas and tricks in Google Sheets? If you regularly need to import data from\u00a0.csv or .tsv files from the web, see <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_text _builder_version=&#8221;4.22.2&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>To combine data from many spreadsheets, Excel files, and other sources and keep it updated on a schedule, <a href=\"https:\/\/www.sheetgo.com\/automations\/\">Sheetgo<\/a>, an AI-powered data automation platform, connects them without formulas.<\/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":"closed","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":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/posts\/2649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/comments?post=2649"}],"version-history":[{"count":1,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/posts\/2649\/revisions"}],"predecessor-version":[{"id":266560,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/posts\/2649\/revisions\/266560"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/media\/4230"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/media?parent=2649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/categories?post=2649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/fr\/wp-json\/wp\/v2\/tags?post=2649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}