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):


    • Related Articles

    • Where can I find the documentation for the Google Drive Connection?

      You can find documentation related to all the COZYROC SSIS+ Component Suite components from the main products page.  Specific documentation for the Google Drive Connection can be found at the following link.  For many of the components you can find ...
    • How to manually generate a Google Services Token?

      A token-based authentication system allows users to enter their username and password in order to obtain a token, which allows them to fetch a specific resource, without using their username and password. Once their token has been obtained, the user ...
    • How do I access Google Sheets in a Shared Google Drive?

      To access Google Sheets in a Shared Google Drive you have the following two options: Option 1: You should enter for "File Path" the Google Drive file's identifier. You will find the file identifier in the Google Sheets URL. Please look at the ...
    • Considerations when choosing REST token storage

      Since version 2.1 in COZYROC SSIS+ access tokens used by REST Connection Manager can be stored not only in the file system, but also in a database (SQL Server).   Using such a centralized storage addresses the following complications with the ...
    • Why the buttons on the REST Connection manager are missing?

      Problem: I am not able to configure my REST Connection Manager component. After I select "Configuration", the buttons on the REST Connection manager screen are gone, they are missing . Look at the screenshot below: Solution: A possible reason for ...