VanDyke Software

Scripting Examples


Lookup Data from CSV File Using CSV Reader (Python)

There are a number of examples showing how SecureCRT with VBScript can be used to read data from an Excel spreadsheet. However, all of these examples make use of Excel's COM API, which may not be available to SecureCRT when scripting with Python.

This example ( shows how to use the native Python csv reader to read data from a CSV (Comma Separated Values) file and perform a lookup of related data coming from the same row in the file.

Given a CSV file that looks like this...


... the user will be prompted for input. For example:

Whether the user enters data from column #1 or column #2, the script will search for that data. As examples:


The return value will come from column #3 if a match was found in either column #1 or column #2 within the CSV file.

If a supplied input does not match any data, a different message will be displayed.

» » »

Example Script (3.4 KB)

VanDyke Software uses cookies to give you the best online experience. Before continuing to use this site, please confirm that you agree to our use of cookies. Please see our Cookie Usage for details.