How can i create CSV file of the sensor readings?

I want to know how can i create .csv file like excel sheet with the timestamps and sensor readings.How to connect excel file with the bolt to download data constantly ?

Hi @joshishreeda30,

You can download the Bolt data from the graph page by clicking on the Data Download button. The other option is to fetch the data using the API and then save the data using in csv file using the Python code.

import csv
import json
import datetime

from boltiot import Bolt

device_id  = "BOLT1234"
mybolt = Bolt(api_key, device_id)
response = mybolt.analogRead('A0')
data = json.loads(response)
sensor_data = data.get("value")

current_time =

with open("data.csv", "wt") as fp:
    writer = csv.writer(fp, delimiter=",")
    writer.writerow([sensor_data, current_time]) 

Do let me know in case you need further assistance.

1 Like