Search code examples
google-sheetsgoogle-sheets-apicryptocurrencybinance-smart-chainbscscan

How to format BSC Scan API data in Google Sheet?


I am trying the BSCscan API today but I have a problem with the way prices are displayed.

https://api.bscscan.com/api?module=account&action=balance&address=0x0000000000000000000000000000000000001004&apikey=YourApiKeyToken

and it returns the following :

{"status":"1","message":"OK","result":"163794791233420992870477570"}

The result seems in an odd format... In Google sheet, I use an ImportJSON formula and the result is the same.

What is that format ? How can I do to get a correct response ? Have I to convert it in some sort ?

Thanks for helping me !, NiphtiAe


Solution

  • So the format of the return is in WEIs, the smallest unit of the ETH, and the BNB.

    I take the result, I times it by 10^18 and I have my balance in BNB. Then I can convert it in USD or else.

    My next problem is that it only displays whats in the wallet, but not what is in farms, pools...