Next we need to build a mobile-friendly frontend for us to perform CRUD operations (create, read, update and delete) on our book records. As I elaborated in Part 1, we will use AppSheet to do this.
Since we already have a Sheet open to work on, we will use option 1 to let AppSheet associate our sheet with the new app.
After AppSheet is done initializing, it will show you a phone emulator interface on the right with a default list view of our sheet.
It looks simple enough, isn’t it? Although we would like to make sure the ISBN is formatted right and more book data can be surfaced. So let’s hop in and choose Customize you app to enter the edit screen.
Customizing data source
Each worksheet will be mapped to its own table as a unique data source in AppSheet. If you have several worksheets in a file, you can create multiple data sources in the same app and display the different tables in separate views. (Same for meshing different data sources such as pulling from Sheets, Excel and a SQL database in a single app).
In our example, we have only 1 worksheet books so this is the only table we will work on for the time being.
In the Data tab, you can edit the table transformed by AppSheet and its columns. Click on the Book table, you will see that you can make the table read-only (so the app user can view its content but not edit it). You can also filter out all existing entries so that users can create new entry but not edit existing ones via the Security section of the Table. In addition, if you want to share the app with friends, you might want to set security filter so that only rows created by the currently login user is shown. There is indeed a myriad of options to configure the app.
We are more interested in configuring the columns that the table itself. To do so, click the Columns tab or View Columns button in the Table tab.
Notice that AppSheet already selects ISBN as the key (UID) of each row. And it has adopted the types used by the columns in Sheets.
You can change column properties by clicking on the pencil icon on the left of the column name. Just like the table, there’s a myriad of options for you to configure a column including name, types, visibility, default value, whether it’s required, editable, input validation and any formula applied.
Editing ISBN
ISBN should be write-once, read-only after. Its sole purpose is to be a unique identifier (key) for records in our app, so it doesn’t need to be visible for editing after the initial data entry.
We will first change the ISBN row as follows,
show: unchecked, then click the inverted glass icon to enter this expression: =ISBLANK([_THIS]) in the Expression Assistant. You will see that AppSheet also provides many prebuilt expressions, and there is a convenient Test feature to test the validity of your expression on the existing table.
Click Save to save your expression for this field.
Type Details/Show thousand separator: unchecked
Update Behavior/Editable: unchecked
Click Done to save our changes.
Editing Status
Status should be an enumeration with predefined values. We will change the type to Enum and then add the valid values in the Type Details section as follows.
Considering that when we add a book, we are usually in the state of starting to read it. So we should update the Auto Compute/Initial Value field to the expression ="reading"
Editing Timestamp
Timestamp (both the add and completion) should be automatically filled in by the system to avoid inaccurate entry. So we’ll make sure this by editing the Timestamp column’s AutoCompute/Initial Value. And we find out that AppSheet automatically applies the NOW() formula to this value. Nice touch! Just make sure Update Behavior/Editable is unchecked so it is write-once.
Editing CompletedTime
The CompletedTime is only relevant when we finish a book, i.e., when the Status flag is completed. Moreover, its sole purpose is to be used to calculate the elapsed time, so we really don’t need to surface it. So we will edit it as
- show: unchecked
- type: ChangeTimeStamp. This data type will record the current time when a specific column has changed to a particular value.
- Columns: Status
- Values: completed
Editing ReadAgain
This value is only relevant when we finish a book. So we will make the following changes
Show: uncheck, then enter AND([status] <> "reading", ISNOTBLANK([status])) as a formula Type: Enum Values: You can add any value you want. I use the followings
Editing DaysRead, Year & DaysAfterCompleted
We also change both DaysRead and DaysAfterCompleted to a Number type. They both require an additional step as AppSheet defaults them to a DataTime type and assigns them initial value of the current time. To change both to a Number type, we need to remove the expression in the Auto Compute section used to calculate the initial value first.
We should uncheck the show thousands separator for Year column.
In addition, we will uncheck Update Behavior/Editable for all 3, since we will rely on our Sheets formula to calculate these columns instead.
DaysAfterCompleted should only be displayed when we finish a book. So we should set its Show field to the expression =[status]="completed"
Finally, change Rating to a number, uncheck the Required field for both Year and Description. We will leave other columns as-is from now.
Click the Save button on the upper-right corner of your screen to save our project. Notice that the phone emulator will update whenever we make a change.
Customizing our views
In the UX pane, you will see the default views we’ve experienced so far. Primary Views such as a List are those that will surface as tabs in our app, whereas Ref Views are those that are invoked by specific actions such as clicking an Add or Edit button. Now let’s customize each of them to suit our need!
Primary Views
Click the Books view under Primary View to edit it. Notice that by default, a Card view is chosen to display our rows. In addition, it is grouped by status and further sorted by the time created. It even nicely shows the number of rows in each status category by count aggregation!
You can flip around the different view types to see which one fits your need better. For example,
- if we fetch the book cover image from Books API, we can use the Gallery view type to display our books like in a visual bookshelf.
- We can also employ the Table view type to display our data in a more traditional spreadsheet like format.
- Or we can use the Deck view type to display each book in a single page, then use the swipe action to view other books.
We can leave the view type as-is, but further fine tune its Layout section.
Accept the default list but change the followings
- Click Title goes here and on Column to show, choose
Title
- Click Subtitle goes here and on Column to show, choose
Author
Since we haven’t fetched the cover image, we can leave the paper airplace icon choice blank. Dataset with photos that can uniquely distinguish a row (such as inventory management, employee records, etc.) can also use the other 3 layouts that give a much bigger emphasis on the photo, as well as include more information on each row.
Notice that our emulator on the right shows a refreshed view of what we’ve changed. Now it looks more informative!
Ref Views
We can now view our data easily. Now let’s customize the Create and Update operations by modifying the Ref Views.
Click the Book_Form view to edit. 
What’s important here is to enable Auto Save. You can also customize the Column Order to rearrange (or omit) which column you want to allow editing. In addition, you can use the Finish view to pick what view the form will return to, when you finish editing it. You can choose between the Books list view (our primary view when we launch the app), or go to the Details view of the book you’ve just edited.
Similarly, you can modify the way data show up in the Books_Detail view.