arrow_back

Generating Reports with AppSheet Automation

Teste e compartilhe seu conhecimento com nossa comunidade.
done
Tenha acesso a mais de 700 laboratórios, selos de habilidade e cursos

Generating Reports with AppSheet Automation

Laboratório 1 hora universal_currency_alt Sem custo financeiro show_chart Introdutório
info Este laboratório pode incorporar ferramentas de IA para ajudar no seu aprendizado.
Teste e compartilhe seu conhecimento com nossa comunidade.
done
Tenha acesso a mais de 700 laboratórios, selos de habilidade e cursos

Overview

AppSheet enables you to create files and reports for your app with automation. The data for the file or report comes from the tables used by the app. As your app is used and the data is updated, the generated file contains the latest app data.

With automation, you can generate a file or report on a regular schedule or based on a data change event in the app.

Objectives

In this lab, you learn how to perform the following tasks:

  • Create a simple template to generate a file with AppSheet automation.

  • Create and configure a task, process, data change event, and bot to generate a file on Google Drive.

  • Use a template with start expressions to generate a report.

  • Create and configure a task, process, scheduled event, and bot to send an email with the generated report as an attachment.

Setup

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long lab resources will be made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It gives you new, temporary credentials to sign in and access AppSheet for the duration of the lab.

What you need

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).

  • Time to complete the lab.

  1. Make sure you sign in to the lab using an incognito window.

  2. When ready, click start lab button.

    A new panel will appear with the temporary credentials that you must use for this lab.

    If you need to pay for the lab, a pop-up will open for you to select your payment method.

  3. Note your lab credentials. You will use them to sign in to AppSheet for this lab.

    If you use other credentials, you will get errors or incur charges.
  4. Click Open AppSheet to open the AppSheet UI in a separate browser tab or incognito window.

    Note: If you are not already using an incognito browser window, use the right mouse click in Chrome to open AppSheet and select Open link in incognito window.
  5. Click to sign in with Google.

    Sign in with Google

  6. In the Sign in with Google dialog, enter the provided Username, and click Next.

    Note: If you see other accounts listed, click Use another account and then enter the provided Username and click Next.If you use other credentials, you'll get errors or incur charges.
  7. Enter the provided Password and click Next.

  8. Click Accept to accept the terms.

  9. To enable AppSheet to access the Google Drive folders associated with your lab account, on the AppSheet consent page, click Allow.

    Sign in with Google - provide consent

  10. You're now signed in to AppSheet.

    To view the AppSheet MyApps page, click X in the top-right corner of the Tell us about you so we can make better recommendations dialog.

    The MyApps page might be empty since you do not have any apps yet.

Task 1. Create the app

When working on your own app, you normally would incrementally build the app over a continuous project timeline.

Apps that you build are saved and accessible in the Recent section on the Apps page until they are deployed and published.

In this task, you create the app that was built in a previous lab, using a template.

Delete prototype app (if listed)

In the lab environment, the app built in a previous lab might still be listed in the Recent section. You cannot use this app to continue working on this lab because the underlying data is not available for use by the app.

The app must be deleted before you continue with this lab.

  1. If the Facility Inspections app is listed, on the 3-dots menu, click Delete.

  2. To confirm the deletion, click Delete.

Copy a template app to your AppSheet account

To continue building the Facility Inspections app in this lab, you must first recreate the app from a template.

  1. To copy the Facility Inspections app to your AppSheet account, click the link: Facility Inspections

  2. In the app preview, click Accept.

  3. In the left navigation menu, click Copy app (copy app).

  4. In the Copy app form:

    a. For App name, type Facility Inspections

    b. For Category, select Inspections & Surveys.

  5. Leave the remaining settings as their defaults, and click Copy app.

    AppSheet creates the app and copies the Google sheet that is used by the app to the /appsheet/data/FacilityInspections-nnnnnnn folder under the My Drive folder on Google Drive.

    AppSheet creates a folder for each of your apps with your account ID (represented by nnnnnnn) in the data folder.
  6. Click Customize your app to go to the AppSheet editor.

    You can also access the app from the Apps page in the AppSheet UI under Owned by me.

    Your app is set up with the original facilities data source, and you can now continue to build out the app's functionality. In this lab, you will create automation bots to generate files and reports on the inspection data used in the app.

Click Check my progress to verify the objective. Create the app.

Task 2. Create automation to generate a file

AppSheet automation includes a task category that creates a file on your cloud provider's file system.

In this task, you create and configure the automation components to create a file on Google Drive. The file will contain the data for a newly created facility inspection.

Create the automation task

  1. In the AppSheet UI, in the left navigation bar, click Automation (Automation) > Tasks.

  2. To create a task, click Create a new Task (+).

  3. In the new task form, specify the following:

    Property

    Value


    (type or select)

    Task category

    Create a new file

    Task name

    Create inspection file

    Table name

    Inspections

    HTTP Content Type

    PDF

  4. You use a template to provide and format the contents of the generated file. For Template, click Create.

    AppSheet creates a template file on Drive and displays the document ID.

  5. To view the contents of the template, click View.

  6. Edit the template to make the following changes:

    a. Change the title heading from Create inspection file to Inspection file.

    b. Add a header below the title: Created on: <<_TODAY>>

    Format the header as a Heading 2 header in the Google doc.

    _TODAY is a built-in AppSheet variable that returns the current date. Enclose the variable in angle brackets (<<, >>) to use it as a template variable.
  7. In the AppSheet editor, for File Name Prefix, click Filter (filter).

  8. In the Expression Assistant form, for File name prefix expression for action Create inspection file (Text), delete AppSheetDoc, and type [Status].

    The expression uses the value in the Status column of the inspection row being created in the app as a prefix for the file name. When the file is created, the file name includes this prefix along with the current timestamp.

    The data from each individual passed or failed inspection will be stored in its own file on Drive.

  9. In the Expression Assistant, click Save.

  10. Leave the remaining settings as their defaults for the task, and click Save.

Create an automation process

Next, you create a process with a step that will execute the file creation task that was created earlier.

  1. In the AppSheet UI, in the left navigation bar, click Automation (Automation) > Processes.

  2. To create a process, click Create a new Process (+).

  3. For the New Process, click More (More) and Rename to Create inspection file.

  4. For Table, select Inspections. This process uses the Inspections table.

  5. To add a step to the process, click Add a step.

  6. For Step name, type Create inspection data file, and press ENTER.

  7. Click the Create inspection data file step.

  8. For the type of step, select Run a task, and then select the Create inspection file task that was created earlier.

  9. Click Save.

Create an event

With the process and task created, you now create and configure an event that triggers a bot to run the process.

  1. In the AppSheet UI, in the left navigation bar, click Automation (Automation) > Events.

  2. Click Create a new Event (+).

  3. For the New Event, click More (More) and Rename to New inspection created.

  4. For Event Type, select Data Change.

    The automation bot that creates the report will be triggered when a new inspection is created in the app.
  5. Click Adds only.
    This event will be triggered when a row is created in the Inspections table using the app.

  6. For Table, select Inspections.

  7. Leave the remaining settings as their defaults, and click Save to save your changes to the app.

Create the automation bot

Finally, you create the automation bot that is triggered by the event. When the event occurs, the bot runs the process that it's configured with.

Create the bot

  1. In the AppSheet UI, in the left navigation bar, click Automation (Automation) > Bots, and click Create a new Bot (+).

  2. Click Create a new Bot.

  3. For the New Bot, click More (More) and Rename to Inspection created.

  4. In the bot definition, click Configure event.

  5. Select the New inspection created event that you created in the previous task.

  6. For Run this process, click the arrow to display a list of processes, and select the Create inspection file process that you created earlier.

  7. Click Save.

Click Check my progress to verify the objective. Create the file automation task.

Task 3. Test the automation

It's now time to test the automation that creates a file with inspection data from the app.

Add a facilities inspector

Before you can create an inspection, you must first add yourself as a facilities inspector in the app.

  1. In the AppSheet UI, in the left navigation bar, click Data (data).

  2. In the app preview, click the main menu (main menu).

  3. In the app's main menu, click Inspectors.

  4. To add yourself as an inspector, click Add (add inspector).

  5. In the new inspector form, specify the following, and leave the remaining settings as their defaults:

    Property

    Value


    (type or select)

    First Name

    [your first name]

    Last Name

    [your last name]

    Email

    [your Google Cloud Username from the Qwiklabs credentials pane]

    Phone

    1-555-555-5555

    Manager Email

    [your own email address]

    Shift

    Night

    In the form, replace the square brackets and italic text in the table with the required values.

    Note: For the Manager Email, please provide your own email address in order to receive email from AppSheet. If you do not have one, you can sign up for a test Gmail account at mail.google.com.

  6. In the app preview, click Save.

  7. Wait a few seconds for the app to automatically sync the update to the backend, or to sync the data changes manually, click Sync (sync).

Create new inspections

  1. To create a new inspection, in the navigation bar at the bottom of the app preview, click Inspections.

  2. Click the Pier 46 facility.

  3. To add a new inspection, in the app preview, click Add (add inspection).

  4. In the new inspection form, specify the following, and leave the remaining settings as their defaults:

    Property

    Value


    (type or select)

    Inspection Point

    Loading Docks

    Well Lit?

    Y

    Surfaces Clean?

    Y

    Garbage Emptied?

    Y

    Doors Locked?

    Y

    Area Organized?

    Y

    Status

    Inspection Passed

  5. To go to the next page in the new inspection form, in the navigation bar of the app preview, click Next.

  6. For Signature, click Tap to unlock, and using the mouse, draw a signature.

  7. In the app preview, click Save.

  8. Repeat the steps above to create a failed inspection by setting these values in the inspection form:

    Property

    Value


    (type or select)

    Inspection Point

    Product Bins

    Well Lit?

    Y

    Surfaces Clean?

    Y

    Garbage Emptied?

    N

    Doors Locked?

    Y

    Area Organized?

    N

    Status

    Inspection Failed

  9. Click Next, provide your signature, and click Save in the app.

  10. Wait a few seconds for the app to automatically sync the update to the backend, or to sync the data changes manually, click Sync (sync).

Verify file creation

There should be two files created on Google Drive: one for each inspection that was created in the previous task.

  1. In a separate browser tab, navigate to https://drive.google.com.

  2. If prompted, sign in to Drive with your lab credentials.

  3. In My Drive, open the AppSheet folder, and then from the AppSheet folder, open the data folder.
    This is the default folder location on Drive that AppSheet uses to store your app's images and other files.

  4. Open the FacilityInspections-nnnnnnn folder.

  5. In this application folder, open the Files folder. There should be two files listed whose names begin with Inspection Passed and Inspection Failed.

  6. Open each of the files to view its contents. Verify that the content is formatted based on the template that was used in the automation task.

Inspection files created.

Task 4. Generate a report with automation

In this task, you generate a report of the daily inspections created in the app. You use AppSheet's automation features to periodically send an email with the report as an attachment.

Create the automation components: Bot and event

  1. In the AppSheet UI, in the left navigation bar, click Automation (Automation) > Bots, and click Create a new Bot (+).

  2. Click Create a new Bot.

  3. For the New Bot, click More (More) and Rename to Daily inspection report.

  4. To configure an event that will trigger the bot, click Configure event.

  5. For the Event name, type Schedule daily inspection report, and press ENTER.

  6. In the Settings pane, specify the following, and leave the remaining settings as their defaults:

    Property

    Value


    (type or select)

    Event Type

    Schedule

    Schedule

    Daily

    Time

    [Type the current time]

    Time zone

    [Select the time zone nearest to you]

    Replace the square brackets and italic text in the table with the required values. You will update the Time value later when testing the bot.

Create the automation components: Process, step, and task

Continue configuring the bot with a process, step, and task:

  1. For Run this Process, click the arrow, and select Create new process, and then enable Linking.

  2. To add a step to the process, click Add a step.

  3. For the Step name, type Email inspection report, and press ENTER.

  4. To create a task, in the Settings pane, enable Linking:

    Property

    Value


    (type or select)

    Type of task

    Send an email

    Email Type

    Custom template

    Table name

    Inspections

  5. To provide the email address of the recipient, for To, click Add, and then type your own email address.

    Note: Make sure the email address is valid and you can access it to view emails sent to this address. If the email address contains special characters like a hyphen or plus, enclose the entire email address in quotes.
  6. In the Settings pane, continue to configure the task by specifying the following:

    a. For Email Subject, type Daily Inspection Report for: <<_TODAY>>

    b. For Email Body, type Please review today's inspection report attached to this email.

    c. Click Attachment settings.

    d. For Attachment Content Type, select PDF.

    e. For Attachment Template, click Folder (folder).

    f. In the Upload from dialog, click Google Drive Files.

    g. In the file chooser dialog, select the attachment template file DailyInspectionReport_AttachmentTemplate from My Drive. Click Select.

    h. For Attachment Name, type Daily Inspection Report

    The template for the report attachment has been pre-provisioned in the My Drive folder on Drive. You can view the contents of the report template in by opening the file named: DailyInspectionReport_AttachmentTemplate

    The template uses a StartExpression with a condition to fetch rows from the Inspections table that have an inspection date that matches the current date. It formats the inspections into two separate tables in the report organized by passed and failed inspections. Each table uses column variables to display values from the relevant Inspections table columns for passed and failed inspections.

  7. Leave the remaining settings as their defaults and click Save.

Task 5. Test report generation

Now that you have all the automation components created, you can test report generation.

Deploy the app

AppSheet will send email notifications from automation tasks only to the app creator while the app is in prototype state. For other users to receive notifications, the app must pass a deployment check and be deployed.

  1. To run a deployment check, in the AppSheet UI, in the left navigation bar, click Manage (Manage) > Deploy tab and click Deployment Check.

  2. Click Run deployment check.

  3. There should not be any errors displayed for your app. Ignore the warnings, and click Move app to deployed state.

Update the scheduled event time

The event that was configured to trigger the report generating bot is on a fixed schedule. For lab testing purposes, you simply update the event's scheduled time to the current time.

  1. In the AppSheet UI, in the left navigation bar, click Automation (Automation) > Bots.

  2. Click Daily inspection report.

  3. Select the Schedule daily inspection report event to view its configuration.

  4. Update the time of the event to the current time or one minute after the current time.

  5. To save your changes, click Save.

Verify receipt of the email and contents

  1. Wait for the event to trigger.

  2. In a separate browser tab, access the email account that you configured for the task.

  3. Verify that an email with the subject line: Daily Inspection Report for: [Today's date] was received.

  4. Open the email and view the message content. Then, open the PDF attachment.

  5. Verify that the contents of the file includes the two inspections created earlier in the lab.

    Note: Some columns in the report may be empty if data was not available for an inspection row in the table.

Congratulations!

Congratulations on completing this lab on report generation with AppSheet automation.

In this lab, you learned how to perform the following tasks:

  • Create a simple template to generate a file with AppSheet automation.
  • Create and configure a task, process, data change event, and bot to generate a file on Google Drive.
  • Use a template with start expressions to generate a report.
  • Create and configure a task, process, scheduled event, and bot to send an email with the generated report as an attachment.

End your lab

When you have completed your lab, click End Lab. Qwiklabs removes the resources you’ve used and cleans the account for you.

You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.

The number of stars indicates the following:

  • 1 star = Very dissatisfied
  • 2 stars = Dissatisfied
  • 3 stars = Neutral
  • 4 stars = Satisfied
  • 5 stars = Very satisfied

You can close the dialog box if you don't want to provide feedback.

For feedback, suggestions, or corrections, please use the Support tab.

Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

Este conteúdo não está disponível no momento

Você vai receber uma notificação por e-mail quando ele estiver disponível

Ótimo!

Vamos entrar em contato por e-mail se ele ficar disponível