SetExcelCell
Sets the text value of the specified cell in Excel.
Syntax
SetExcelCell(worksheet, cell, text, excelFilePath)
Parameters
Parameter |
Type |
Description |
---|---|---|
worksheet |
string |
The name of the worksheet |
cell |
string |
Excel cell specification, Should be in the form CR where C is Excel column name, R is the row number. For example, ‘A1’ is the top-left cell in the worksheet. |
text |
string |
The text to be copied to the cell |
excelFilePath |
string |
Full path of the Excel file. This parameter is optional. See Usage below. |
Return
None.
Note
See Specifying Windows file paths in Python for details on specifying file paths with backslashes in Python.
Examples
Python
import nex
# this call will open Excel, Excel will create
# a new workbook (Excel file) and paste the text to the specified cell
nex.SetExcelCell("fromNex", "A1", "cell text")
# this call will set the cell in the specified Excel file
nex.SetExcelCell("fromNex", "A1", "cell text", "C:\\Data\\Results.xlsx")
NexScript
% this call will open Excel, Excel will create
% a new workbook (Excel file) and paste the text to the specified cell
SetExcelCell("fromNex", "A1", "cell text")
% this call will set the cell in the specified Excel file
SetExcelCell("fromNex", "A1", "cell text", "C:\Data\Results.xlsx")