Need help exporting csv file from Thingspeak

Hi All,
I'm trying to export my data from the Thingspeak site, I am getting the csv file but it only contains field 1, besides the timestamp and lat/long data, which is blank as I don't use. I have a total of 3 fields. I am using the "DOWNLOAD" button at the bottom of the import/export page for my channel.
I know I'm missing something but several hours of searching yields nothing.
Any help would be greatly appreciated.
Cheers
Paul

 Akzeptierte Antwort

Manikanta Aditya
Manikanta Aditya am 12 Apr. 2025
Bearbeitet: Manikanta Aditya am 12 Apr. 2025

0 Stimmen

Hi @Paul,
It sounds like you're encountering an issue with exporting all your fields from ThingSpeak. Here are a few steps you can try to resolve this:
  • Ensure that all three fields are enabled and actively collecting data in your ThingSpeak channel settings.
  • Verify that your CSV file is properly formatted. The headers should include all fields you want to export, such as created_at,field1,field2,field3,latitude,longitude,elevation,status.
  • When using the "DOWNLOAD" button, make sure you're not inadvertently selecting only field 1. You might want to try exporting data using the API to ensure all fields are included. Use the following API endpoint to export all fields:
https://api.thingspeak.com/channels/<channel_id>/feeds.csv?api_key=<APIKEY>
Replace <channel_id> and <APIKEY> with your actual channel ID and API key.
Refer to the following MATLAB Answer which talks about the similar issue you encountered:
I hope this helps.

4 Kommentare

Paul
Paul am 13 Apr. 2025
Thank you @Manikanta Aditya, much appreciated.
I have tried a few things and have moderate success.
I don't understand how to setup the csv files for export using the "EXPORT" button, do I need to create and upload a file first and import a set of data to set the stage for export?
Using the API export method yields good results, all fields export, except only todays data, I can't figure out how to export older data. I tried using the "results" modifier making it 700,000 entries which is how many entities I have for the last 1.5 years, but it only exported 8,000 entities, about a weeks worth, no matter what number I used.
Thank you for your help.
Cheers,
Paul
Hi @Paul,
  • You do not need to create and upload a file first. The "EXPORT" button should allow you to download the data directly.
  • Ensure that your channel settings are correctly configured to include all fields in the export.
  • If you have a large number of entries, you might need to paginate your API requests to retrieve all data. This involves making multiple requests with different date ranges or using the results parameter to limit the number of entries per request.
  • The API method you mentioned is correct, but to export older data, you need to specify both the start and end parameters in your API request. This will allow you to define a date range for the data you want to export.
https://api.thingspeak.com/channels/<channel_id>/feeds.csv?api_key=<APIKEY>&start=<start_date>&end=<end_date>
Replace <channel_id>, <APIKEY>, <start_date>, and <end_date> with your actual channel ID, API key, and desired date range.
I hope this clarifies. Accept the answer if it helped.
Paul
Paul am 14 Apr. 2025
We're in business! Thank you. I looked at my channel setup and everything was set correctly, nothing has changed in a long time, all 3 fields were checked etc.. I decided just on a whim to hit the SAVE button again then tried using the EXPORT button and this time it worked, dowloaded all 3 fields and I can see the data!
I have no idea why it fixed things but it did. You have taught me now multiple ways to extract data from Thingspeak, thank you so much for your help.
Cheers
Paul
@Paul, That's great to hear, Cheers!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by