• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

Google Sheets - Add new Row - retrieve row number

erh

Member
I'm using the Google Sheets action "Add new row" -- is there a way to use a variable which represents the row number that was just added to?

Right now I have to do something rather complicated: =INDIRECT("AnotherSheet!A" & ROW())

This fetches the value in the sheet "AnotherSheet", in column "A", at the Row of the currently edited cell. Alas, the =INDIRECT function causes the entire spreadsheet to re-calculate, and is sort of janky.

Is there a variable available in the "Add new row" function that can represent the row being added to?

At the very least to allow later actions to use the Row# to retrieve data without requiring a "Lookup SPreadsheet Rows" action?
 

ArshilAhmad

Moderator
Staff member
Hi @erh,

The 'Google Sheets: Add New Row' action step does provide you with the row in which the data has been added. You can extract it in the manner suggested below.
 
  • Like
Reactions: erh

erh

Member
Hi @erh,

The 'Google Sheets: Add New Row' action step does provide you with the row in which the data has been added. You can extract it in the manner suggested below.
Great idea. I think it can be even easier, actually, using Text Formatter: Extract Pattern

I was able to use this to extract the last digit: (\d+)$

This is an example string from your linked workflow:
Code:
2. Updates UpdatedRange : Sheet1!A19:D19

The result was 19.

Question, do you know for a fact that the Add New Row action's UpdatedRange return string's Last Row variable will always be the row that was just recently added to?
 
Top