Category: How do I do X?


This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Write data to different googlesheets columns depends on content in unput field


As a new user of this tool, I have a question. I have a Google sheet with columns for content1, content2, and content3. In my app, there's an input form with fields for Content and number, as well as a Save button. I want to save data from the Content field to either content1 or content2 depending on whether the number field is 1 or 2. Can you help me figure out how to do this?


To accomplish this task, you will need to create an AppSheet app and connect it with your Google Sheet data source. Then, create an input form with two fields: "Content" and "Number". Next, add a "Save" button to the form.

In the app editor, go to the behaviors tab and select "Actions". Create a new action and name it something like "Save Content". Set the action type to "Data: set the values of some columns in this row". Under "Columns to set", select "content1" for the first case and "content2" for the second case. Add a conditional expression for each case to determine which column to set the value for based on the value of the "Number" field. For example, for the first case, the expression would be [Number] = 1.

Next, go back to the form editor and add the "Save Content" action to the "Save" button. Now, when a user enters content in the "Content" field and selects "1" or "2" in the "Number" field and presses "Save", the data will be saved in the corresponding column in the Google Sheet.

You can test this by entering sample data in the form fields and pressing "Save". Then, go to the Google Sheet and check that the data has been saved in the correct column.