Can traccar push data to Google Sheets

Morten2 months ago

Is it possible to set up the server to push received data from the GPS trackers to Google Sheets? And if so how would you go about it?

Or would it be simpler to basically fetch the data from the SQL server itself (I have my traccar server hosted online)?

Anton Tananaev2 months ago

It cannot push directly to Google Sheets, but it can call a webhook or forward data to another system, like Kafka.

Morten2 months ago

Ok thanks - would it be able to call a webhook every time an object updates for instance? Also on a slightly different note, the api/device endpoint dosn't seem to provide lat/long but rather just a positionID. Is there any way to translate this positionId to something more usefull?

Anton Tananaev2 months ago

If you want location data, you have to call the position endpoint instead of device.

Morten2 months ago

That makes sense! :)

But when reading the documentation it strongly suggest to use the websocket api instead of polling the endpoint too often?

Anton Tananaev2 months ago

That is correct.

Morten2 months ago

Ok - I might have to look into that then. What's the risk, if I poll the /positions endpoint every 30 seconds for instance?

Anton Tananaev2 months ago

It will read data from the database. And if you have a lot of users, it will be a significant load on the database, which is already a bottleneck.

Morten2 months ago

Hmm ok - I will only have one user reading and 50-ish devices. But I will look into the websocket instead :)

Anton Tananaev2 months ago

If you don't expect to have other users, then it probably doesn't matter what you do. Polling would work just fine. The only thing you won't get is live updates with polling.

Morten2 months ago

Ok great - I'll see what's easiest for me to implement in my solution :)

Morten2 months ago

Another related question about the /positions endpoint I figure I imght as well ask here. Would it be possible to trim the data shown in the JSON response by editing a config file or something?

It returns as lot of data that isn't of much use in my case (information about signal strength for instance), so slimming it down would be neat.

Anton Tananaev2 months ago

You can use computed attributes if you want to completely remove some data, but it will be removed from everywhere.

Morten2 months ago

Can you elaborate that a bit? I'm unsure what youre meaning.

Anton Tananaev2 months ago

Which part is not clear?