How to upload an Excel file to Google Drive as a Google Spreadsheet

How to upload an Excel file to Google Drive as a Google Spreadsheet

In order to upload an Excel file to Google Drive as Google Spreadsheet you need to:

Create a project in Visual Studio. To establish a Connection Manager to Google Drive, you need to use a Google Drive Connection (see Quick Start >> Establish Connection). 



Then, drag and drop a JavaScript Task to the Control Flow canvas:


While configuring the JavaScript Task you need to choose the pre-built Script Rest Web Service Request Task as shown below:


Examples of JavaScript Task configuration - two scenarios:

1. Upload the excel file to Google Drive root folder (My Drive): 
        Example:
      

As shown in the screenshot above, you should put in URL and Body  the following:
Body: {"name":"eventsImport.xlsx","mimeType":"application/vnd.google-apps.spreadsheet"}

After running the package – the file is uploaded as a Google Spreadsheet to My Drive root:

      

2. Upload the excel file to a particular folder in Google Drive (a folder in My Drive):

Example:

      

You should put in URL and Body the following:
Body: {"name":"eventsImport.xlsx","mimeType":"application/vnd.google-apps.spreadsheet","parents":["here you need to fill the relevant Folder ID"]}

For parents, you will need the Google Drive Folder ID (the ID of the Google Drive Folder you would like to upload the excel file to). This Folder ID  is everything that comes after “folders/” in the URL in the Google Drive you would like to use. For example, if the URL was “https://drive.google.com/drive/folders/1dyUEebJaFnWa3Z4n0BFMVAXQ7mfUH11g”, then the Folder ID would be “1dyUEebJaFnWa3Z4n0BFMVAXQ7mfUH11g”.


After running the package - the file is uploaded as a Google Spreadsheet to the desired folder (in the example - Folder: 17534):


    Book a Presales Call


    Are you new to COZYROC and evaluating our solutions? 
    Book a Presales Call with us now and get 5% off SSIS+.