![]() The URL can simply be copied from the top of the web page that you want to pull data from. =importxml("", "/html/body/div/div/div/main/div/section/div/div/div/ div/div/div/div/div/div/div") Both of these criteria are entered between quotation marks. Notice the first criteria is the URL, and the second criteria is the XPath which is a long code. The video below goes over using IMPORTXML in more detail than the video at the top.īelow is an example of the IMPORTXML formula. In that article I go over the process of finding the correct XPath in much more detail. The formula requires two major components: #1 The website URL, and #2 the XPath of the "element" that contains the data that you want to pull into your spreadsheet.Ĭheck out this article to learn how to use cell references with the IMPORTXML formula, as well as to learn more details about using the IMPORTXML formula. The IMPORTXML function can be used to pull data directly from websites into a Google spreadsheet (This process is called "web scraping"). This content was originally created by Corey Bustos / Pull cryptocurrency prices into Google Sheets with the IMPORTXML function You can also pull the price for Ethereum (ETHUSD) with the GOOGLEFINANCE function. If you wat you can enter the symbol for the cryptocurrency into a cell in your spreadsheet, and then you can simply refer to the cell as the criteria for your formula, like this: =GOOGLEFINANCE("BTCUSD")Īs you can see in the image above, by using the formulas above… the price for Bitcoin is pulled directly into a spreadsheet. To pull the price of a cryptocurrency with the GOOGLEFINANCE function, simply enter the symbol for cryptocurrency pair between quotation marks, as the criteria for the formula, like this: =GOOGLEFINANCE("BTCUSD") In this example we will use the GOOGLEFINANCE function to find the price of Bitcoin, displayed in US Dollars. Example: Pulling crypto prices with GOOGLEFINANCE In this article I will stick to teaching how to pull the current price for cryptocurrencies. The GOOGLEFINANCE function can also be used to pull a wide variety of data for stocks, such as past prices, shares outstanding, etc./ but I will go over that in another article. When using the GOOGLEFINANCE function with ordinary stock symbols, there is more criteria that you can specify, which would allow you to show many other types of stock data other than just the current price… but we are going to use the most basic criteria for this function by specifying a cryptocurrency symbol only, to display the current price of the specified crypto (When no additional criteria is given to the formula, the default is to show the current price). When entering the cryptocurrency symbol that Google Sheets will expect, you have to enter the cryptocurrency “pair”, such as the pair between Bitcoin and US Dollars, which is represented as “BTCUSD”. With this method, all that you have to do is specify the cryptocurrency symbol for the criteria in the formula, and the formula will display the current price for that cryptocurrency. (See below for how to use this method provided by ) Pull cryptocurrency prices into Google Sheets with the GOOGLEFINANCE functionįirst let's go over the more simple method for pulling crypto prices into Google Sheets, which is by using the GOOGLEFINANCE function. =GOOGLEFINANCE("BTCUSD") Using IMPORTXML to pull crypto prices (Formula) Using GOOGLEFINANCE to pull crypto prices (Formulas) *Note that when using the IMPORTXML function, websites often change the XPath of their website elements and so you will need to follow the lesson below to learn how to retrieve the correct XPath for your formula. The formulas below can be used to pull crypto prices into a Google spreadsheet. Formulas for pulling crypto prices into Google Sheets ETHUSD (Ethereum) is another symbol that the GOOGLEFINANCE function will pull. The IMPORTXML function is able to pull in any crypto price, where the GOOGLEFINANCE function is limited on the cryptocurrencies that it can pull. You can also click here to get even more detail on using IMPORTXML.Ĭlick here to get your Google Sheets cheat sheet Watch the other video further down the page to get more detail on using the IMPORTXML function. This IMPORTDATA method is described in the video directly below, or you can scroll down to the bottom of the page to read about it. Note that a new method for pulling crypto prices has been added to this page, (the ability to use the IMPORTDATA function for crypto prices). Press enter on the keyboard (Final formulas will look like this: =GOOGLEFINANCE("BTCUSD")īelow I go over an example of using this method in detail, and then further below I will teach you how to use the IMPORTXML function.Type a symbol for a cryptocurrency (between quotation marks), like this "BTCUSD".Type =GOOGLEFINANCE( in a spreadsheet cell to begin the formula.To pull cryptocurrency prices into Google Sheets, follow these steps:
0 Comments
Leave a Reply. |