Enable Users to Export to Excel

As an administrator, you configure the instance for users to export visualizations to Excel.

Note:

Any shared libraries that are required for the Chromium browser must be installed.

Topics:

Certification - Systems for Export to Excel

Here're the operating systems certified for using export to Excel in Oracle Analytics Server.

Supported Processors

Processor OS Version OS Update Level Oracle JDK Version* Additional information
Linux x86-64 Oracle Linux 8 0+ 1.8.0_341+ Oracle Fusion Middleware installer supports JDK 1.8.0_341+.
Microsoft Windows x64 2012, 2016, 2019 SP 0+ 1.8.0_341+ -

* Oracle Analytics Server only supports Oracle JDK. Others, such as OpenJDK, aren't supported.

Install NodeJS and Modules

The first step in configuring for exporting to Excel is to install NodeJS and its modules.

Disclaimer: Because this solution requires the customer to download and install third party software (NodeJS and modules), any licence implications or security vulnerabilities are the responsibility of the customer.

Note:

  1. Download and install the latest LTS version of Node.js (version 18.18.0 or later) from https://nodejs.org/en/download for your operating system.
  2. Create or modify package.json to include the below NPM modules as a dependency:
    NPM Module Version
    express ^4.17
    jquery-deferred ^0.3.1
    log4js 6.4.1
    html-to-xlsx ^2.2.0
    puppeteer 20.7.4
    Sample package.JSON
    {
       "name": "exportexcel",
       "version": "1.0.0",
       "description": "",
       "dependencies": {
          "express": "^4.17",
          "jquery-deferred": "^0.3.1",
          "log4js": "6.4.1",
          "html-to-xlsx": "^2.2.0",
          "puppeteer": "20.7.4"
       }
    }
    
  3. Configure the NPM registry and proxy, if required, using these commands:
    To set npm registry - npm config set registry <registry url> 
              To set proxy - npm config set proxy http://<username><password>@proxy-server-url>:<port>      
                       npm config set https-proxy http://<username><password>@proxy-server-url>:<port> 
              Note: username and password are optional
  4. Run npm install to install the NPM modules listed in the table.

Set Up Environment Variables for the Node Process

You must configure environment variables to point to the NodeJS installation on the virtual machine and for the Oracle Analytics Server Platform, before you can start the NodeJS process.

  1. Set the environment variables for the node process.
    Environment variable Description Required?
    NODE_PATH Environment variable that nodejs looks up for node packages. This is the path to the node_modules directory. For example,

    <Directory where node_modules are installed>/node_modules

    Yes
    PUPPETEER_EXECUTABLE_PATH Environment variable that Puppeteer looks up for the chrome executable. This is the path to the chrome executable. The default location to download Chromium is:

    Linux: $HOME/.cache/puppeteer

    Windows: [drive]:\users\<user>\.cache\puppeteer

    The path to the chrome executable is:.

    Linux: $HOME/.cache/puppeteer/chrome/<version>/chrome-linux64/chrome

    Windows: [drive]:\users\<user>\.cache\puppeteer\chrome\<version>\chrome-win64\chrome.exe

    To change the default location where you download Chromium, check https://pptr.dev/guides/configuration.

    Yes
    TMP_DIR Writable directory where the xlsx files are stored temporarily. If not set, the default is the operating system temp directory. No
    LOG_DIR Writable directory where log files are written to. If not set, the default is the operating system temp directory. No
    EXCEL_NODE_PORT Port where the export Excel service listens. If this environment variable isn't set, the server starts on port 3001. No
  2. Set the environment variable required by the Oracle Analytics Server Platform.
    Environment variable Description Required?
    OAS_FORMATTED_EXPORT_ENABLED The environment variable looked up by the Oracle Analytics Server Platform to enable the export excel feature. When you set this, the NodeJS setup is completed and node process (export excel service) is running. Accepted values - true/false.

    Note:

    You must restart the system after you set the environment variable.
    Yes

Start and Stop the NodeJS Process

Once you set the environment variables, as an administrator you can start and stop the NodeJS process. You must start the NodeJS process before users can begin exporting to Excel.

  1. Start the NodeJS process using this sample script:
    On Linux:
    LOG_DIR=<log directory> #Writable log directory
      
    mkdir -p ${LOG_DIR}
      
    "nohup" "node" "bi/modules/oracle.bi.tech/obitech-serverside-exportexcel-bundle.js" > 
    ${LOG_DIR}/biexportexcel.log &
    i=0
    max_attempts=60
    excelAppPID=0
    echo "Export excel app is starting..."
    while [[ i < max_attempts ]];
    do
       pgrep -f "bi/modules/oracle.bi.tech/obitech-serverside-exportexcel-bundle.js"
       if [ $? != 0 ]; then
           i=$((i+1))
           sleep 1
       else
           echo "Export excel app is running"
           exit 0
       fi
    done
    echo "Export excel app failed to start after 60 seconds"
    exit 1
  2. Stop the NodeJS process using this sample script:
    On Linux:
    excelAppPID=$(pgrep -f "bi/modules/oracle.bi.tech/obitech-serverside-exportexcel-bundle.js")
    if [ $? != 0 ]; then
    excelAppPID=""
    fi
      
    if [ -n "${excelAppPID}" ]; then
    echo "Stopping Export excel App with pid: ${excelAppPID}; killing (SIGTERM) ..."
    kill $excelAppPID
    fi