Read in a CSV of terms and definitions

This part of the script easy enough to understand.  First, I created a two column spreadsheet in Excel of terms (item) and definitions.  This listing was then saved as a .CSV file named C:\scripts\Input\test.csv.

Next, Import-Csv read the file C:\scripts\Input\test.csv into the variable $tester.  An additional variable was created based off of the count of the imported "questions" from test.csv.  The first row of this data starts with 0 (zero) so we subtract 1 from the count.

# -----------------------------------------------------------------------
# Read in data and get count
# -----------------------------------------------------------------------
$tester = Import-Csv C:\scripts\Input\test.csv

$defCount = $tester.Count -1

No comments:

Post a Comment