A Workflow Rule or Scheduled Report can be used to create and save a file.

HTTP Content Type

The file can contain data in any one of the following formats:

  1. CSV
  2. JSON
  3. PDF
  4. XML

Template

You control the file contents by specifying a Template. The Template can take many forms including:

  1. CSV template
  2. JSON template
  3. PDF template
  4. XML template


CSV Template:

You can create an CSV file using a template file.

To create a CSV template file:

  1. Set the HTTP Content Type property to "CSV".
  2. Click the Create button following the Template property.
  3. Click the View button following the Template property to see the template.

You can manually create a template file by creating an empty .txt file on your personal computer, entering CSV text like that below, and saving the file to your personal computer.

"UpdateMode","Application","TableName","UserName","LastName","FirstName","Age","ComputedTotal","ComputedName"

<<Start: Select(MyTable[MyKey], TRUE)>>

"<<_UPDATEMODE>>","<<_APPNAME>>","<<_TABLENAME>>","<<_USERNAME>>","<<[LastName]>>","<<[FirstName]>>","<<[Age]>>","<<[Qty]*[Price]>","<<_ComputedName>>"

<<End>>

Once the template file is saved to you personal computer, upload it to one of the following Data Sources:

  1. Box
  2. Dropbox
  3. Google Drive
  4. Microsoft Office 265
  5. Microsoft OneDrive

For example, you can upload the template file to Google Drive, as follows. 

  1. Open Google Drive and navigate to the Google Drive folder where you wish to upload the file. 
  2. Click the "New" button and then click "File upload". 
  3. When the file open dialog appears, navigate to the template file on your personal computer, select the file, and click "Open". This will upload the template file to Google Drive.

Once the template file is uploaded:

  1. Click the file icon for the Template field. 
  2. When the "Select a file" dialog appears, navigate to the uploaded template file and select it.
  3. This makes the uploaded template file the current Template.

Each time you modify and upload the template file to Google Drive, Google Drive will assign it a new DocId. You must click the file icon for the Template field, as described above, to make the newly uploaded template file the current Template.


JSON Template:

You can create an JSON file using a template file containing JSON.

To create a JSON template file:

  1. Set the HTTP Content Type property to "JSON".
  2. Click the Create button following the Template property.
  3. Click the View button following the Template property to see the template.

You can manually create a template file by creating an empty .txt file on your personal computer, entering JSON text like that below, and saving the file to your personal computer.

{
  "MyTable": [
  <<Start: Select(MyTable[MyKey], TRUE)>>
      {
         "UpdateMode": "<<_UPDATEMODE>>",
         "Application": "<<_APPNAME>>,
         "TableName": "<<_TABLENAME>>,
         "UserName": "<<_USERNAME>>,
         "LastName": "<<[LastName]>>",
         "FirstName": "<<[FirstName]>>",
         "Age": "<<[Age]>>",
         "Computed Total": "<<[Qty]*[Price]>>",
         "ComputedName": "<<_ComputedName>>"
      },
   <<End>>
   ]
}

Once the template file is saved to you personal computer, upload it to one of the following Data Sources:

  1. Box
  2. Dropbox
  3. Google Drive
  4. Microsoft Office 265
  5. Microsoft OneDrive

For example, you can upload the template file to Google Drive, as follows. 

  1. Open Google Drive and navigate to the Google Drive folder where you wish to upload the file. 
  2. Click the "New" button and then click "File upload". 
  3. When the file open dialog appears, navigate to the template file on your personal computer, select the file, and click "Open". This will upload the template file to Google Drive.

Once the template file is uploaded:

  1. Click the file icon for the Template field. 
  2. When the "Select a file" dialog appears, navigate to the uploaded template file and select it.
  3. This makes the uploaded template file the current Template.

Each time you modify and upload the template file to Google Drive, Google Drive will assign it a new DocId. You must click the file icon for the Template field, as described above, to make the newly uploaded template file the current Template.

PDF Template:
PDF attachments are the most popular form of attachment.

To create a PDF template file:

  1. Set the HTTP Content Type property to "PDF".
  2. Click the Create button following the Template property.
  3. Click the View button following the Template property to see the template.

You can modify the Google Doc or a Microsoft Word template file as described here.

XML Template:

You can create an XML file using a template file containing XML.

To create a XML template file:

  1. Set the HTTP Content Type property to "XML".
  2. Click the Create button following the Template property.
  3. Click the View button following the Template property to see the template.

You can manually create a template file by creating an empty .txt file on your personal computer, entering XML text like that below, and saving the file to your personal computer.

<?xml version="1.0" encoding="UTF-8"?>
<records>
   <<Start: Select(MyTable[MyKey], TRUE)>>
      <record>  
         <UpdateMode><<_UPDATEMODE>></UpdateMode>
         <Application><<_APPNAME>></Application>
         <TableName><<_TABLENAME>></TableName>
         <UserName><<_USERNAME>></UserName>
         <LastName><<[LastName]>></LastName>
         <FirstName><<[FirstName]>></FirstName>
         <Age><<[Age]>></Age>
         <Computed Total><<[Qty]*[Price]></Computed Total>
         <ComputedName><<_ComputedName>></ComputedName>
      </record>
   <<end>>
</records> 

Once the template file is saved to you personal computer, upload it to one of the following Data Sources:

  1. Box
  2. Dropbox
  3. Google Drive
  4. Microsoft Office 265
  5. Microsoft OneDrive

For example, you can upload the template file to Google Drive, as follows. 

  1. Open Google Drive and navigate to the Google Drive folder where you wish to upload the file. 
  2. Click the "New" button and then click "File upload". 
  3. When the file open dialog appears, navigate to the template file on your personal computer, select the file, and click "Open". This will upload the template file to Google Drive.

Once the template file is uploaded:

  1. Click the file icon for the Template field. 
  2. When the "Select a file" dialog appears, navigate to the uploaded template file and select it.
  3. This makes the uploaded template file the current Template.

Each time you modify and upload the template file to Google Drive, Google Drive will assign it a new DocId. You must click the file icon for the Template field, as described above, to make the newly uploaded template file the current Template.


File Name Prefix

Every file has a File Name Prefix. 

If you do not specify a File Name Prefix, the following default value is used. 

AppSheetDoc

You can specify a constant File Name Prefix.

Order File

You can include variables in the File Name Prefix that are replaced by values from the record.

Order File for <<CustomerName>>

You can include expressions in the File Name Prefix.

Order File for <<CustomerName>> from <<_APPNAME>> on <<TODAY()>>

Disable Timestamp?

By default, AppSheet includes a system generated Timestamp in the file name. The Timestamp  contains the date and time at which the file was created. The date and time are formatted as "yyyyMMdd_HHmmss_fff" where "fff" is milliseconds. This ensures the  file name is unique. For example:

MyFileName20171107_133355_804.pdf

You can omit the Timestamp by setting the Disable Timestamp? option to On in the workflow action. 

If you disable the Timestamp, you must ensure that every file name is unique. If you fail to do this, one file may overwrite another. For example, if you are saving your files to Google Drive, only the most recent file will be present. Earlier files with the same name will be overwritten.

File Folder Path

You can specify the File Folder Path in the workflow action.

If you do not specify the File Folder Path, then the default File Folder Path value "Files" is used.

You can specify a constant File Folder Path. For example: 

MyFiles/MyPurchaseOrders

You can include expressions in the File  Folder Path. For example:

<<CONCATENATE("MyFiles/PurchaseOrdersByMonth_", YEAR(NOW()), "_", MONTH(NOW()))>>

This might yield: 

MyFiles/PurchaseOrdersByMonth_2019_02

As a result, each month's files would reside in a separate folder.

File Archive Location

This article explains how the File Name Prefix, Disable Timestamp?, File Folder Path, and Default app folder properties are combined to control where the file is archived.

Attachment Page Orientation

You can specify either "Portrait" or "Landscape" for PDF files.

Attachment Page Size

You can specify the page size for PDF files.

Did this answer your question?