The file variables support streaming of files directly from the data source to the automation. The file stream capability is available in file variables of both API Tasks and Task Bots.

Create an API Task to upload a file from a Google Drive folder to a Microsoft 365 OneDrive folder using a file variable with file stream support.

Prerequisites

Ensure that the following prerequisites are met:

Procedure

  1. Log in to your instance of the Automation Anywhere Control Room as a Bot creator.
  2. Create a new API Task:
    1. Click Automation from the left pane.
    2. Click Create > API Task.
    3. Enter an appropriate name for the API Task in the Create API Task modal.
      The default location for the API Task is <\Bots\>. Use the Choose button and follow the prompts to save it to a different location.
    4. Click Create & edit.
  3. Go to Variables > Create variable to create a variable.
    1. Select File in the Type field.
    2. Enter filestream as the variable name in Name field.
    3. Optional: Enter an appropriate description in the Description field.
    4. Click Create to create the file variable.
  4. Go to Actions > Google Drive, and double-click Connect to add the action to Bot editor.
  5. Configure the Connect action as follows:
    1. Use one of the following options to enter the Google account username: Credential, Variable, or Insecure string
      Ensure that this username is the same as the username that you use to configure the OAuth connection.
    2. Select Control Room managed from the OAuth2 Authentication Mode
    3. Click Pick and follow the prompts in the Pick an OAuth connection to choose the configured OAuth connection for the Google account.
  6. Go to Actions > Google Drive, and double-click Assign File to add the action to Bot editor.
  7. Configure the Assign File action as follows:
    1. Enter the username of the Google Drive account.
      You can choose one of the following options: Credential, Variable, or Insecure string.
    2. Select Select file access method and enter the folder path <Files/Logs.txt>.
    3. Select filestream from the Assign file to a variable drop down.
      During runtime, the API Task assigns filestream file variable to <Logs.txt> to stream the file.
  8. Go to Actions > Microsoft 365 OneDrive, and double-click Connect to add the action to Bot editor.
  9. Configure the Connect action as follows:
    1. Enter an appropriate user session name in Microsoft 365 OneDrive user session.
      The default user session name is set as Microsoft365OneDriveUserSession.
    2. Select Control Room managed from the OAuth2 Authentication Mode
    3. Click Pick button in Connection, and follow the prompts in the Pick an OAuth connection to choose the configured OAuth connection for the Google account.
    4. Use one of the following options to enter the Microsoft 365 account username: Credential, Variable, or Insecure string
      Ensure that this username is the same as the username that you use to configure the OAuth connection.
  10. Go to Actions > Microsoft 365 OneDrive, and double-click Upload file to add the action to Bot editor.
  11. Configure the Upload file action as follows:
    1. Enter Microsoft365OneDriveUserSession in Microsoft 365 OneDrive user session.
    2. Select Variable > filestream from the OAuth2 Authentication Mode
    3. Click Pick button in Connection, and follow the prompts in the File variable / File name on local directory (including path and extension) to choose the file variable that you created in step 3.
    4. Enter the destination Microsoft 365 OneDrive folder path in Upload folder on OneDrive (including path)
      Go to Microsoft 365 OneDrive destination folder in a browser and click Copy link to copy the folder path.
  12. Click Save to save the API Task.
Go to the folder where you saved the API Task and click Run now from the context menu of the API Task, the API Task assigns the file variable to the Google Drive file and uses the streaming capability to upload the file to the configured Microsoft 365 OneDrive folder.