Use Tasker to delete lines from Google Sheet

117 views
Skip to first unread message

Duckredbeard

unread,
Jul 21, 2020, 1:58:11 PM7/21/20
to Tasker
I am using Joao's HTTP Post to add lines to a Google Sheet in my home security project.  The Sheet documents when doors are opened and closed, motion monitor started and stopped, and motion detected.  Instead of making the document bigger and bigger with each event, I would really only need to keep the last 100 events, or just the last few days.

How can I use Tasker to remove older lines from the Sheet?

João Dias

unread,
Jul 22, 2020, 3:00:42 AM7/22/20
to tas...@googlegroups.com
Maybe this helps?  https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear  

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


Duckredbeard

unread,
Jul 23, 2020, 8:23:09 AM7/23/20
to Tasker
Looks like that will only clear the values.  I want to delete the rows entirely.  Maybe there is a function in Sheets to delete rows without valid values...gears are turning in me head...


In Step 9, I plugged in my global variable names instead of the A, B, and C. to read Body: {"majorDimension":"ROWS","range":"A1:Z1000","values":[["%SECEVENT","%FTIME","%FDATE"]]}  instead of Body: {"majorDimension":"ROWS","range":"A1:Z1000","values":[["A","B","C"]]}.  Once I saw that work, I just ran with that.  Now my "Security Log" spreadsheet shows my "Security Events" with time and date stamps in the spreadsheet.  This works so much faster than using the plugin "Tasker spreadsheet plugin".  It took a while to setup and test, but having it native in Tasker was worth it.  One less app to have installed.

Since I anticipate having more than 1000 lines populated between "cleanings", I made the range A1:Z100000.  This is why I considered the automated function of deleting lines, in case I did not manually delete the older stuff.  It does take a few moments to load the sheet when there are several thousand rows.  I don't see me looking at more than the last few days, which would be a few hundred lines.
Reply all
Reply to author
Forward
0 new messages