Question

To process zipped files from google drive

  • 1 May 2024
  • 1 reply
  • 48 views

Userlevel 2
Badge +5

Hi ,

We have to get the files from the google drive and then process it to get the data from the file.

The format of the file is .xml and they are currently zipped.

In order to extract the data from these files, I need to unzip them and convert the xml format to JSON format. The data further will be stored in various tables.

I learnt from the docs and community that the folder needs to be empty where it needs to be unzipped.

  1. The connection to google drive is working and I can get the list of the files in the drive.
  2. I tried to unzip these files using the unzip connector (by placing the zip file in the location manually) and connecting the task directly with the unzip file connector, however while testing got error as below : 

Process flow: 

Below are my questions : 

 

  1. How can I store the file into storage location using write file if its still zipped.
  2. Is there any document that can guide to create a temporary directory using a GUID and unzip the contents in that directory,as mentioned in below community 

The response from HTTP connector for the files is as below : 

 "kind": "drive#fileList",
  "incompleteSearch": false,
  "files": [
    {
      "kind": "drive#file",
      "mimeType": "application/x-gzip",
      "id": "1_o6P1AF6zkQbo8EYzT8HXbkw3rj-So57",
      "name": "export_b642453b-ec25-11ee-90c8-dac226cdec252024-03-27T10:35:21Z.tar.gzip"
    }

]


1 reply

Userlevel 7
Badge +23

Hi Rucha,

The Unzip file process action is an action done by Indicium and therefore not functioning in the Windows GUI (2-tier).

For this process flow to work as intended you'll need to use either the Universal GUI or make a System flow that handles the files; in a system flow you are able to use the Unzip file.

In order to extract the data from these files, I need to unzip them and convert the xml format to JSON format. The data further will be stored in various tables.

If you are using the Windows GUI, then you'll need a queuing table that holds the jobs for the system flow to process. The System flow itself runs on a schedule and checks the queuing table to see if it has to process something.

If so, information is gathered and the Unzip file is called to extract the XML file into the folder. That XML file can then be read using the Read file connector. Thereafter, you can use the convert XML to JSON process action. After that, the JSON can be used and written to anywhere you would like.

 

How can I store the file into storage location using write file if its still zipped.

You can use the Write file to write a ZIP to a location, simply use the .zip extension behind the file name.

Is there any document that can guide to create a temporary directory using a GUID and unzip the contents in that directory

Not that I know of, but feel free to create one. Using the Create folder process action, you can create a folder in a storage location. You are free to use any naming you like, including a newid() or GUID. Then with the Folder created, you now have the location of the folder. With that location + the file name you can now Write a file to there.

Hope this helps!

Reply