Do not update if the textbox is empty

Hi all,

I think this is more of a general coding logic question but I am pretty new to coding so please pardon my inexperience question.

I have built a blocks that update the row data (3 columns) of google sheet with the values in textbox1 , textbox2 and textbox3. Works well however one problem is if user does not enter any value in the textbox, it will empty the cell.
This can be an issue as it may delete data that the user has no intention to update.

This is my blocks,
update1

And here I have entered a value for textbox1 aiming to update the column in activity but leave the other 2 columns (time,location) intact.

However, it replaced the other 2 cell with empty values:

I understand the reason it got replaced is because my update url includes the other two cells but how do I send the url in a way that can ignore the other 2 cells?

I have tried something like the following, but it still replace the 2 cells.
https://script.google.com/macros/s/AKfycbxMVTQH5KwSWu5NM-3fY-IdzSPB8ms-PUgmzYKcoK-L/exec?ID=1MjgLJY0IliWPZCXMxzs4MBOLroG3uyxhe7EP&SH=Sheet3&func=Update&id=1&activity=soccer

Thanks for any help in advance!

if textbox is empty, then get the table cell value instead, this will just overwrite the existing cell value with the same value in the spreadsheet.

You have the data for the tableview as a list, and the row index, use that to get the table cell value

2 Likes

Thanks again @TIMAI2 , got it. worked out with your suggestion.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.