VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Example: Integrating with Microsoft Excel (

bgagnon 01-28-2013 12:22 PM

Example: Integrating with Microsoft Excel
8 Attachment(s)
Example: Excel Spreadsheets - Adding, Copying and Renaming Sheets
This example script demonstrates how to add, rename and copy an Excel worksheet. This script also demonstrates one way to see whether a sheet already exists with the specified name, which is needed because trying to rename a sheet to an existing sheet's name causes an error.

Example: Excel Spreadsheets - Reading and Writing
This example script shows how to read (and write) data from (and to) an Excel spreadsheet using VBScript running within SecureCRT. This specific example connects one by one to hosts (IP address is read in from column "A") and port (read in from column "B") using a connection protocol (read in from column "C") authenticating with user & pass (read in from columns "D" and "E"). The command 'sh config' is run on the host unless the value in column "F" is "No", and then writes the date & time of the activity as well as the results of the command in columns "G" and "H", respectively.

Example: Excel Spreadsheets - Searching and Lookups
Two example scripts (first lookup example, second lookup example) showing how to search for (look up) data within an Excel spreadsheet using VBScript running within SecureCRT, and read data from other cells within the row that contained the data that was found.

Example: Launch SecureCRT from Excel spreadsheet using on-the-fly script
The RunSecureCRTWithAScriptCreatedFromExcelMacro.cls.txt and RunSecureCRTWithAScriptCreatedFromExcelMacro_JumpHost+Enable.cls.txt examples show how, from within an Excel macro, you can gather information from the current row (the active row) and use that info to create an on-the-fly VBScript code file in a temporary location. Once the script file is created, SecureCRT is launched with the /SCRIPT command line option, as well as /ARG elements so that the script SecureCRT is told to run knows a) which protocol to use (Telnet/SSH2/SSH1), b) what hostname to connect to, c) what username to authenticate as and d) what password to use for authentication. Once the SecureCRT instance that was launched has terminated, the temporary script file is deleted.

Pic of spreadsheet for RunSecureCRTWithAScriptCreatedFromExcelMacro.cls.txt example:
Pic of spreadsheet for RunSecureCRTWithAScriptCreatedFromExcelMacro_JumpHost+Enable.cls.txt example:

All times are GMT -6. The time now is 04:58 PM.