How to read the contents of a downloaded file
When you download any file using Google Drive, Dropbox or other such actions, it is saved temporarily in the Built.io Flow 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 - Use Google Drive action
Add Google Drive – 'Download File' action to the canvas and configure it as per the instructions given below:
Authorize Google Drive: Select the access token from the drop‐down list. If you have not created an access token yet, click ‘Add new’ to create one.
File ID: Select/specify the ID of the file that you want to download.
File Name: Enter name by which you want to save the file along with the file extension.
Once you have entered all the details, click ‘Next’. In the next window that appears, you will see a ‘Test’ button.
When you click on ‘Test’ button, Built.io Flow fetches the latest file from your Google Drive account, and displays it in the new window that appears.
When you click on ‘Test’ button, Built.io Flow will test the action. This serves two purpose: First it checks whether the action has been configured properly, and second it displays the latest downloaded file in the ‘Output’ tab.
If you want the data of some other file, you can click the ‘Retest’ button.
Click ‘Done’ to return back to canvas. At this stage if you run the workflow, the specified file will be downloaded to Built.io Flow engine local storage. To read/access this file, use Dropbox 'Download file' action.
Step 2 - Use Dropbox action
Add Dropbox 'Upload File' action to the canvas.
You will see the data of the Google Drive 'Download File’ action under the ‘Download File’ output, given on the right-hand side of the configuration window. You can see the actual values of the ‘Download File’ parameter against the keys, and also the data type of values.
Configure the action as given below:
Source File Path: Add the output parameter 'filepath' of Google Drive 'Download File' action under ‘Download File’, given on the right-hand side of configuration window, as an input for this field.
Destination File Path: Select/specify the complete path of the Dropbox folder where you want to save the file.
Once you have entered all the details, click ‘Next’, and test the action by clicking on ‘Test’ button.
When you click this button, Built.io checks whether the action has been configured properly, and uploads downloaded file to Dropbox account, and displays the details in the ‘Output’ tab that appears.
You can also directly click on ‘Done’ and ‘Run’ the workflow if you do not want to test it.
The specified downloaded file will be uploaded to the 'Dropbox' folder from where you can read the file.