Delete Row for "Create new action..." workflows

I’m actually the opposite-- I haven’t done a script in Sheets yet :scream: lol
I like the visual nature of Integromat so will try this first. Thanks!

2 Likes

@SantiagoPerez So I am trying to do the delete row function in integromat but I get stuck on this screen. Is there a way to delete a row that matches 2 specific cell values?
I’m trying to do an “Unfollow” action for a social network, so it is checking a UserToUserRelation sheet to find a row that has a specific Follower ID and Followee ID which I’m able to pass to Integromat.

Anyone know if this is possible?

Hola @ray_d,

If I understand correctly, that information isn’t actually written in the GS. Any info coming from a relation, lookup, rollup, etc. doesn’t get written in GS.

How are you passing it to the GS? I guess that’s where we need to start. What’s the specific value in the GS that you need the scenario to look at?

2 Likes

I’m not trying to write to the Google Sheet. I’m trying to pass user Row ID’s (follower and person being followed) to the google sheet to identify which row to be deleted. I see that Integromat looks for the Row Number, so I was wondering if I pass the Row ID’s to look for, then with some logic in integromat, it would be able to find the right row number to delete. Do you know if this is possible?

Or is there a way to find the Google Sheet row number in Glide before I send it to Integromat? :thinking:

1 Like

I don’t know if that’s possible. Maybe @gvalero could shed some light :bulb: on it.

1 Like

Maybe you can create a column with the number of row next to ROW ID, so you can send the row number to INTEGROMAT

Let me test to verify some details. The point here is to know and mark the right row (someting like ROW_ID that @wjcv06 says) dynamically to hep Integromat,

Saludos

2 Likes

The only “problem” is that for example I wanna delete row number 5 and you wanna delete row number 6, when Integromat deletes my row (number 5), row number 6 becomes row number 5 in GoogleSheets so when Integromat deletes row number 6 actually will eliminate former row 7 :confused:

I think this is the best option ↓

3 Likes

The trick is to delete rows from botton to top. This is what @Darren_Murphy wrote above.

You will have this problem using GS Script as well if you delete rows from top to botton.

Saludos!

2 Likes

Correct, here…

Another thing that is critical when deleting rows using a trigger script is to make absolutely certain that you’re referring to the correct column index as a trigger. I managed to accidentally delete an entire sheet (over 1000 rows) by getting careless with this (thank goodness for GSheet versioning). This is why I now ALWAYS use column 2 as my trigger column.

I actually now prefer to avoid deleting rows unless absolutely necessary, and instead do a “soft” delete by marking them as deleted with a timestamp, and then just use the presence of that timestamp to hide them from view.

5 Likes

Ok I see now why delete may not be necessary… that checkbox approach is genius! I’ll see if that will work via Create new action > Set row > Deleted = true

I guess only downside is that this leaves a bunch of unused rows, but I guess you can manually delete these rows later.

2 Likes

This is interesting, yet all too real today. I literally just lost an entire inline list of posts (and post stats; 20 days worth) due to wrong Col clear :woozy_face:

I’ve taken note of using specific columns for specific variable types (text, number, date/time, etc.)

However, would it be possible to write a script if the Col used was a timestamp - and the row deletion (starting from the bottom :+1:t2:), was determined if NOW is -AFTER- Timestamp? :thinking:

Learning curve is welcomed - thanks in advance!

Yes, that’s certainly possible. Although probably much simpler to do that logic in the GDE.
Just change your “Is Deleted?” column to an IF-THEN-ELSE

If Now() > Timestamp
Then true
Else false

(you might need some additional logic to cover the case where the timestamp is empty)

Ok gotcha. So instead of a Gsheet, I could just use Glide Table then?

…I’ve never really delved too deep into Glide Tables, yet.

No, I wasn’t suggesting a Glide table.
I was just suggesting doing that date checking logic in Glide, rather than using a script.

Here is an example of what I mean:

The 4th column in the above example is an ITE column that returns true if Check Out is on or after Now.
Of course, because that is a calculated column it won’t appear in your Google sheet (so you can’t use a script to do a hard delete), but you can use it to hide those “deleted” rows from view.

Oh yeah - I’m currently doing this (visibility settings for instant results for User).

I just meant if it was possible, using a script to delete rows in the gsheet, using a trigger that checks to see if =NOW() is -after- Timestamp (say it’s posted to Col 2), so as to limit number of rows used.

*Thanks for the replies, by the way!

Yes, it’s possible. Here is a modified version of my earlier script that will do that.

function remove_deleted_rows_older_than_now(sheet) {
  var rows = sheet.getLastRow();
  var now = new Date().getTime();
  for (var row = rows; row >= 2; row--) {
    var checkval = sheet.getRange(row, 2).getValue();
    if (checkval != '') {
      var rectime = new Date(checkval).getTime();
      if (now > rectime) {
        sheet.deleteRow(row);
      }
    }
  }
}

It expects the timestamps to be in column 2, and will ignore any that are empty.
Please note: I haven’t fully tested that (I don’t have time right now), so please use with caution.

1 Like

Ok thanks this is great! I’ll try it out in a test app first then haha

This was so deterring today so I really appreciate the help. :pray:t2:

Just now chiming in on this thread. 100% need a “Delete Row” action.

Vote here:

Visibility conditions to “archive” rows work (and are a REALLY useful feature when you need to preserve relations/rollups of previously entered information), BUT these rows still count against your row quota.

Likewise, clearing all columns via a Set Column action doesn’t quite work, because these phantom rows, even when using a Glide Table, count against your Row Quota. For instance, in the image below, the two selected rows were cleared using set column, but these two rows are still included in my number of used rows.

The way I see it, the only way to delete rows is via script or integromat, BUT you end up sacrificing UX with the lag time.

A “Delete Row” action would be the best solution by far.

This functionality already exists via the “Edit > Allow users to delete” screen (which DOES allow you to earn back rows to your quota!), so all we’d need is an action to trigger that delete action.

Please and thank you!

@mark @david

9 Likes

Voted @Robert_Petitto

2 Likes