Read the Excel worksheet in Powershell
How could I improve it so that it can remove all the contents of column B (starting at line 5, so that the line 1-4 is ignored) on each sheet and create an object?
This suggests that the content is in column B on each sheet (because it is not clear how you define a column on each page.) The last line of this column is also the last line of the sheet.
perhaps, as I read it, but assuming that the Excel sheet 1 is called the London and has this information, B5 = B6 = Marlibon Paddington Victoria B7 = B8 = Hammersmith. And excel sheet called Nottingham 2 and has this information, C5 = Alverton C6 = Annesley C7 = Arnold C8 = Askham. Then I think this code will work. ^ _ ^
City Area —- —-
Nottingham, Alverton, Nottingham, Nottingham Annsli
It was extremely helpful to me when I was trying to automate the SIP-phone setup Cisco using electronic Excel spreadsheet as the source. My only problem was that I was trying to create an array and fill it using $ array | Add-Member. Since later I needed to use it to create a configuration file. Simply determine the mass and making it loop for, he will be able to store.
Previously, I had no problem with the addition of information in an array using the Add-Member, but it was in PSv2 / 3, and I spent some time it shall not go. Although a simple solution saved me from manual configuration 100+ phones and extensions that nobody wants to do.