# Download csv without abbreviating 1,000,000 into 1M

**URL:** <https://community.bitquery.io/t/download-csv-without-abbreviating-1-000-000-into-1m/243>\
**Category:** GraphQL API\
**Tags:** closed\
**Created:** [June 28, 2021, 10:23am UTC](https://community.bitquery.io/t/download-csv-without-abbreviating-1-000-000-into-1m/243 "2021-06-28T10:23:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fekry11](https://avatars.discourse-cdn.com/v4/letter/f/e274bd/32.png) [@fekry11](https://community.bitquery.io/u/fekry11)\
**Post date:** [June 28, 2021, 10:23am UTC](https://community.bitquery.io/t/download-csv-without-abbreviating-1-000-000-into-1m/243/1 "2021-06-28T10:23:13Z")

</div>

Hello  
I am trying to download tx amount, when usng this query and downloading results as csv i get 1,000,000 abbreviated to 1M and 1,000,000,000 abbreviated into 1G, is there a way to get the exact number without abbreviation?

```
                    query ($network: EthereumNetwork!,
                            $address: String!,
                            $limit: Int!,
                            $offset: Int!
                            $from: ISO8601DateTime,
                            $till: ISO8601DateTime){
                ethereum(network: $network){
                  transfers(options:{desc: "block.timestamp.time" asc: "currency.symbol" limit: $limit, offset: $offset},
                    date: {since: $from till: $till },
                    amount: {gt: 0},
                    sender: {is: $address}) {

                    block {
                      timestamp {
                        time (format: "%Y-%m-%d %H:%M:%S")
                      }
                      height
                    }
                    address: receiver {
                      address
                      annotation
                    }
                    currency {
                      address
                      symbol
                    }
                    amount
                    transaction {
                      hash
                    }
                    external
                  }
                }
              }
```

---

<div class="post-metadata">

**Author:** ![fekry11](https://avatars.discourse-cdn.com/v4/letter/f/e274bd/32.png) [@fekry11](https://community.bitquery.io/u/fekry11)\
**Post date:** [June 28, 2021, 10:28am UTC](https://community.bitquery.io/t/download-csv-without-abbreviating-1-000-000-into-1m/243/2 "2021-06-28T10:28:29Z")

</div>

![firefox_yTo0nijUr7](https://us1.discourse-cdn.com/flex016/uploads/bitquery/original/1X/692fb70457d243f0485a9fe760ef8c94c302cb02.png)  
when pressing play in query editor it shows whole number without abbreviation but when pressing apply and download csv file its abbreviated.  
thanks for any help

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [June 29, 2021, 6:14am UTC](https://community.bitquery.io/t/download-csv-without-abbreviating-1-000-000-into-1m/243/3 "2021-06-29T06:14:07Z")

</div>

Yes, it’s a UI thing, you can write a simple JS code that will solve this.

@sayon Please create a tutorial on how to get Bitquery API data as CSV. Also share simple JS code.

---

<div class="post-metadata">

**Author:** ![sayon](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sayon](https://community.bitquery.io/u/sayon)\
**Post date:** [June 29, 2021, 6:27am UTC](https://community.bitquery.io/t/download-csv-without-abbreviating-1-000-000-into-1m/243/4 "2021-06-29T06:27:18Z")

</div>

I’ll start right away with the same

---

<div class="post-metadata">

**Author:** ![sayon](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sayon](https://community.bitquery.io/u/sayon)\
**Post date:** [June 29, 2021, 11:20am UTC](https://community.bitquery.io/t/download-csv-without-abbreviating-1-000-000-into-1m/243/5 "2021-06-29T11:20:35Z")

</div>

```auto
const FileSystem = require('fs')
const { writeFile } = require('fs').promises;
const fetch = require('node-fetch')

function convertJSONTOCSV(objArray){
    var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
    var str = '';
    for (var i = 0; i < array.length; i++) {
        var line = '';
        for (var index in array[i]) {
            if (line != '') {line += ','}
            line += array[i][index];
        }
        str += line + '\r\n';
    }
    return str;
}

async function writeCSV (fileName, data) {
  try {
  	await writeFile(fileName, data, 'utf8'); 
  } catch (err) {
    console.log(err);
  }
}

async function generateCSV(){
	const query = `YOUR GRAPHQL QUERY `;
	const url = "https://graphql.bitquery.io/";
	const opts = {
	    method: "POST",
	    headers: {
	        "Content-Type": "application/json",
	      	"X-API-KEY": "YOUR UNIQUE API KEY"
	    },
	    body: JSON.stringify({
	        query
	    })
	};
	const results = await fetch(url, opts).then(res => res.json())
	
	const objectArray = results.data.ethereum.dexTrades

	// data in JSON format
	// console.log(objectArray.map(it=>console.log(it)))

	const jsonObject = JSON.stringify(objectArray)
	const data = convertJSONTOCSV(jsonObject)
	writeCSV('results.csv', data)
}

generateCSV(); 

```

---

<div class="post-metadata">

**Author:** ![sayon](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sayon](https://community.bitquery.io/u/sayon)\
**Post date:** [July 9, 2021, 7:06am UTC](https://community.bitquery.io/t/download-csv-without-abbreviating-1-000-000-into-1m/243/6 "2021-07-09T07:06:25Z")

</div>


