How To Query for Ether Balances
If you're starting with Web3 Sheets, you might want to call in your ether balance. This tutorial assumes you already have Web3 Sheets installed.
Web3 Sheets Demo: Ether Balances
Requirements
- You need your wallet address.
Basic Example
The structure of the query is as follows:
=ETHBALANCE(address)
For example, let's say you want to look up Getty's ether balance.
=ETHBALANCE("0x9B68c14e936104e9a7a24c712BEecdc220002984")
Historical Ether Balances
To make a historical call simply add the desired block number to the call. For example, let's say you want to look up Getty's balance of ether at block 16987717. It should return 0.334553379.
=ETHBALANCE("0x9B68c14e936104e9a7a24c712BEecdc220002984",16987717)
Use =timestampToBlock("blockNumber","chain")
to find the block number nearest to a timestamp!
For example, =TIMESTAMPTOBLOCK("1680760800","ethereum")
will return 16987717.
Multichain (gas token) Balances
Every EVM blockchain has a gas token asset. For Ethereum, it is ether; for Polygon, it is Matic; for Binance Smart Chain, it is BNB, and so on. The ETHBALANCE function will return an address's balance of the specified chain's gas token.
The structure of the query is as follows:
=ETHBALANCE(address, block/latest, network)
For example, let's say you want to look up Getty's current MATIC balance on Polygon.
=ETHBALANCE("0x9B68c14e936104e9a7a24c712BEecdc220002984","latest","polygon")
To make a historical call, simply replace the "latest" with a block number.
=ETHBALANCE("0x9B68c14e936104e9a7a24c712BEecdc220002984",20474350,"polygon")