How to read the contents of a downloaded file

When you download any file using Google Drive, Dropbox, or other such applications, it is saved temporarily in the webMethods.io Integration engine local storage. In order to read/access this file, you need to use other online file storage applications where this file can be uploaded. Let’s understand how it works with the help of an example.

Suppose you need to download a file using Google Drive and read it. To do this, follow the steps given below:

Step 1 - Configure the Google Drive-Download File by ID action

Add the Google Drive connector to canvas, connect it to the Start icon, and double-click the connector icon. This will open the configuration window where you can select the action you want to use.

2-google-drive.png


Select Action: For the purpose of this tutorial, select the downloadFileById action from the drop down list. This will populate the below two fields:

Name: Provide a label for the action you want to configure.

Authorize Google Drive: Select the account you want to use to execute the action, from the drop‐down list. If you have not created an account yet, click on the + button. You will see two options:

Default Authorization: Select this option to allow webMethods.io Integration to automatically generate all keys required to execute all Google Drive actions.
Or:
Select this option to provide the relevant keys required to execute all Google Drive actions.

    Select one of the options, provide the required information as prompted on the screen, and click Add.

    This will create a new account for your Google Drive account. Once you create an account, you can use it to execute all other Google Drive actions and triggers.

    Once this is done, click Next, test the action, and click Done.

    At this stage, if you run the workflow, the specified file will be downloaded to webMethods.io Integration engine local storage. To read/access this file, use Dropbox Download file action (or any other similar action of a cloud storage application).

    Step 2 - Configure the Dropbox-Upload File action

    Add Dropbox connector to canvas, connect it to the Google Drive connector, and double-click the Dropbox connector. 

    Select the Upload File action, provide a label for action, and add or select the account you want to use to execute the action, just like we did for Google Drive.

    3-dropbox.png

    Once you have entered all the details, click NEXT, test the action, and click Done.

    Step 3 - Save and run the workflow

    Connect the Dropbox application icon with the Stop icon, Save the workflow, and click on Test.

    This will download the specified file from your Google Drive account and upload it to the specified folder in Dropbox, where you can read the file.