This is my code:
$Process = @()
$Energy = @()
Import-Csv C:\Users\Shuai\Desktop\test\Test.csv |`
ForEach-Object {
$Process += $_."Process"
$Energy += $_.Energy
}
$inputName = Read-Host -Prompt "Process"
if ($Process -contains $inputName)
{
Write-Host "Customer Exists!"
$Where = [array]::IndexOf($Process, $inputName)
$Energy[$Where]
}
I use this code to read data from the .CSV. Currently, there is only one worksheet. I want to add another worksheet with a new table in the same file. How to read data from this new worksheet without affecting the first one? Do I need to make variables for both of the worksheets? What code should I use for this?