MS Excel & MS Word Without Interop Objects

See Using the Microsoft Office Library.

These functions apply to Word and Excel files that are in XML format, that is, from Office 2007, files with extensions docx and xlsx.

The export and import DataTable functions apply to files with extensions xlsx and csv.

For sample projects, see Using MS Excel & MS Word Without Interop .

Function / Event

Return Value

Description

Syntax

MS Word Without Interop

In all functions, specify the name of the Word document along with its path (case sensitive).

Get Document Text Text

Retrieves all the text from the Word document.

Get Document <Select Document Name> Text

Replace Text in Word Document None Finds existing text in a Word document and replaces it with new text. Specify the name of the Word document along with its path.

Replace Text in Word Document <Select Document Name> <Select Find What> <Select Replace What>

Append Text to Word Document None Appends the text to the end of a Word document and saves it. Specify the name of the Word document along with its path.

And Text to Word Document <Select DocName> , Text = <Select Text>

MS Excel Without Interop

In all functions, specify the name of the Excel document along with its path (case sensitive).

Append Rows in Excel

None

Adds rows to the end of the specified sheet in the Excel file.

Append rows in <FileName> <Sheet name> with data types as <Add ColumnTypes> and <Add Rows>

Clear Excel Rows Boolean

Clears the data from the range of rows from an excel sheet. This range is considered from Start Row and End Row. Make sure that value in End Row is larger than the value in Start Row.

To delete all the rows in an excel sheet, enter '0' in Start Row and End Row.

Clear the rows in Excel file <File Name with Path> on sheet <Sheet Name> from row <Start Row> to row <End Row>
Delete Excel Rows Boolean

Deletes a range of rows from an excel sheet. This range is considered from Start Row and End Row. Make sure that value in End Row is larger than the value in Start Row.

To delete all the rows in an excel sheet, enter '0' in Start Row and End Row.

Delete the rows in Excel file <File Name with Path> on sheet <Sheet Name> from row <Start Row> to row <End Row>

Export DataTable to CSV

Boolean

Exports an existing DataTable to a CSV file. See DataTable Library Object.

Export DataTable <DataTable> to CSV with <FileName> and <Delimiter>

Export DataTable to Excel

Boolean

Exports an existing DataTable to a Excel file. See DataTable Library Object.

Export DataTable <DataTable> to Excel with <FileName> having <SheetName>

Get Excel Cell Value Text Returns the value of a cell from the specified sheet in the Excel file. Get excel <File Name> <Sheet Name> cell with  <Address>
Get Table Range in Excel Text Returns the table range for the specified table in the Excel file. Get Table Range in Excel <FileName> <Sheet Name> having Table Name <Table Name>

Import CSV to DataTable

DataTable

Imports a DataTable from a CSV file. See DataTable Library Object.

Import CSV with <FileName>, <Delimiter> and <ColumnHeader> to DataTable

Import Excel to DataTable

DataTable

Imports a DataTable from an Excel file.

If datatable contains a header, select Column Header as True.

Range is cell range in the excel sheet where datatable is present. If Range is empty, datatable in the cell range is detected automatically. For Example: If datatable is present in cell range A2 to F8, then the Range is A2:F8.

See DataTable Library Object

Import Excel with <FileName>, <SheetName>, <Range> and <ColumnHeader> to DataTable

Insert Row to Excel Sheet Number

Inserts a new row after the specified row number in an excel sheet.

To add a new row before the first row, enter 0 as Row Number.

This function returns the newly added Row Number. In case of failure, -1 is returned.

Insert a new row in Excel file <File Name with Path> on sheet <Sheet Name> after row <Row Number>

Read Column Excel Sheet

List of Text Retrieves the values from all the cells in a column in the specified sheet in the Excel file. Read column from file <File Name> <Sheet Name> starting from cell <StartingCellAddress>
Read Excel Cell Formula List of Text Retrieves the formula from a cell in the specified sheet in the Excel file. Read formula from excel <File Name> <Sheet Name> cell <Address>
Read Range from Excel Sheet List of Row Retrieves lists of cell values from a range of cells in the specified sheet in the Excel file. Each row in the range is stored in a list of cells. Read from file <File Name> <Sheet Name> range <Range>

Read Row from Excel Sheet

Text

Retrieves the values from all the cells in a row in the specified sheet in the Excel file.

Read row from file <File Name> <Sheet Name> starting from cell <StartingCellAddress>

Return First Empty Row Number

Returns the row number of the first empty row present in the provided excel sheet.

In case of failure, -1 is returned.

Return the first empty row from Excel file <File Name with Path> on sheet <Sheet Name>
Return Last Empty Row Number

Returns the row number of the last empty row present in the provided excel sheet.

In case of failure, -1 is returned.

Return the last empty row from Excel file <File Name with Path> on sheet <Sheet Name>

Set Excel Cell Value

Boolean

Sets a cell value in the specified sheet in the Excel file.

Set excel <File Name> <Sheet Name> cell with  <Address> value = <Value>

Write Range in Excel Boolean Inserts values into the specified range of cells in the specified sheet in the Excel file. Write in <File Name> <Sheet Name> range <Range> with data types as <Add ColumnTypes> and <Add Rows>
Write Range in Excel With Headers Boolean Inserts values into the specified range of cells in the specified sheet in the Excel file. This function also adds headers to each column.

Write in <File Name> <Sheet Name> range <Range> with data types as <Add ColumnTypes> and <Add Rows> With Headers <Add ColumnHeader>