Author

Topic: How to pull Coinmarketcap.com Data to a text file? (Read 198 times)

hero member
Activity: 1582
Merit: 759
have you tried fetching the data from the API using some programming language and then using some library to convert the JSON data into a .csv file?
there are quite a lot of them available out there depending on the programming language you are using. for example python: https://stackoverflow.com/questions/46350765/convert-json-to-csv-with-python-3

the .csv file can then be opened with excel and you can start doing anything you want with that data.

To be fair, no programming required (although if he's looking to automate this, it would be better). There are hundreds of sites w/ simple scripts to convert JSON to CSVs

For example: https://json-csv.com/

If you do want to automatically create a CSV file, you can do something like the following (in PHP for example):
Idea/some code from: http://thisinterestsme.com/php-convert-json-csv/

Code:
// Pull the information from the API
$apiUrl = 'https://api.coinmarketcap.com/v1/ticker/';
$apiData = file_get_contents($apiUrl);

//Decode the JSON and convert it into an associative array.
$jsonDecoded = json_decode($apiData, true);
 
//Give our CSV file a name.
$csvFileName = 'data_export.csv';
 
//Open file pointer.
$fp = fopen($csvFileName, 'w');
 
//Loop through the associative array.
foreach($jsonDecoded as $row){
    //Write the row to the CSV file.
    fputcsv($fp, $row);
}
 
//Finally, close the file pointer.
fclose($fp);

// Say something.
print "Complete!";

If you run the script, it will create a file named 'data_export.csv' with the JSON to CSV data. It may require a few edits to make it perfect/flawless, but hopefully you get the gist.
legendary
Activity: 3472
Merit: 10611
have you tried fetching the data from the API using some programming language and then using some library to convert the JSON data into a .csv file?
there are quite a lot of them available out there depending on the programming language you are using. for example python: https://stackoverflow.com/questions/46350765/convert-json-to-csv-with-python-3

the .csv file can then be opened with excel and you can start doing anything you want with that data.
hero member
Activity: 1582
Merit: 759
I know how to pull data from coinmarketcap into an excel sheet already but it's not efficient. So I need a way to download the data to a text file so I can grab it from there with my excel workbook.

So is there anyone that knows How to pull data to a text file from Coinmarketcap.com API?

I'd greatly appreciate it if someone can help me on this



EDIT: I openned this topic in economics also. But couldnt remove this one. So mods, feel free to remove this topic from here. Thank you

This is actually the correct place for the thread, the thread on economics should probably be closed.

How would you want this as a text file? Right now the following URL is JSON: https://api.coinmarketcap.com/v1/ticker/
You can just convert that to text, although it may not be as easy to handle

For example: https://pastebin.com/PHG0bf5g
staff
Activity: 3500
Merit: 6152
I'm not aware of any methods to do that like with Excel where you could install plugins. It shouldn't be hard to achieve though (If I understood what you're trying to achieve). Try to go with C# and Json.net.
sr. member
Activity: 472
Merit: 254
Anlik Coin Fiyatlari BTCkur.com
I know how to pull data from coinmarketcap into an excel sheet already but it's not efficient. So I need a way to download the data to a text file so I can grab it from there with my excel workbook.

So is there anyone that knows How to pull data to a text file from Coinmarketcap.com API?

I'd greatly appreciate it if someone can help me on this



EDIT: I openned this topic in economics also. But couldnt remove this one. So mods, feel free to remove this topic from here. Thank you
Jump to: