Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

Use an imported type library to access an Excel spreadsheet

Use an imported type library to access an Excel spreadsheet

  • Last UpdatedJul 22, 2024
  • 1 minute read

The purpose of this script is to write data to an open Excel spreadsheet.

Before using this script, you must first:

  1. Import the Microsoft Office Excel dll (Microsoft.Office.Interop.Excel.dll) to create the required namespace. From the Galaxy menu, select Import, then Script Function Library.

    Note: The Microsoft Office Excel dll file name and location may vary, depending on which version of Excel is installed.

  2. Open the Excel spreadsheet you want to access. In the following sample script, the Excel file name and path are: C:\documents\sample.xlsx

dim app as object;

dim wb as object;

dim ws as object;

app = CreateObject("Excel.Application");

app.Visible=true;

wb = app.Workbooks.Open("C:\documents\sample.xlsx");

ws = wb.ActiveSheet;

ws.Range("A1").Value = 100;

ws.Range("A2").Value = 200;

ws.Range("A3").Value = "=A1*A2";

LogMessage(ws.Range("A3").Value);

wb.Visible=true;

wb.Close(false);

TitleResults for “How to create a CRG?”Also Available in