Set default value after form submit in google sheets

Viewed 610

I want to set a cell to a default value as soon as a form is submitted to a spreadsheet (I want to add a value after the last value from that the spreadsheet gives me). Since upon a form submit it erases all the values in the row, I can't have a formula in this cell, I think I'd have to do it with AppScripts. I tried doing it with onFormSubmit but I did not get very far with it. Is there a way to do this?

1 Answers

If the formula is going to be the same for each row, you could add an ARRAYFORMULA version of your formula in the second row of your Responses sheet. By putting your formula in the second row you can still add a header to that column.

For example, if you wanted to get the first three characters of whatever is in Column B, in the second row of the column you want your formula in (in your Form Responses sheet), you could use:

=ARRAYFORMULA(IF(B2:B="","",LEFT(B2:B,3)))

If it's just a default value you want in that column, then use something like this:

=ARRAYFORMULA(IF(B2:B="","",your_default_value))

Good luck!

Related