VanDyke Software

Scripting Examples

Index

Save Selected Text to a CSV File

You may have a scenario where there are columns of data (space-separated) on the screen, and you want to get that data into a CSV (Comma Separated Values) file for work in Excel. This script shows how you can take space-delimited columns of text selected in SecureCRT's terminal screen and save it to a CSV file, converting the spaces to commas.

To save time, you can map this script to a Run Script button on SecureCRT's button bar. Once the script is mapped to the button, you can select the data and then press the button to run the script to save the selected data to a CSV file. The script will prompt you for the filename (filling in a sensible default), and then will automatically bring up the CSV file for view in the default system app.

Remember that holding down the Alt key while selecting text allows you to select in "Column Mode" (see this YouTube video for a demonstration) so that you can eliminate unwanted columns prior to having the data saved. This is helpful if you only want a subset of the columns saved to the CSV file.

Example Scripts

SaveSelectedTextToCSVFile.vbs.txt (6.59 KB)
SaveSelectedTextToCSVFile.py.txt (6.39 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.