Script for creating multiple excel

Hi,

I have a excel file (a standard template). I have another server.xls file containing a list of servers and their IP address. I am trying to write a script where it will read from the server.xls pick one servername create a new excel using the template with the name - ****_****_****_Servername_****.xls and populate the servername and its respective IP in this newly created file in a particular cell say B10 & B20. Please advise.

Regards

Vijay

Parents
No Data
Reply
  • A basic xls is no different that a CSV.

    Just use the import-csv cmdlet to read from it and filter on what you want as you read it in or after you read it all into a variable that you can then use.

        # Get parameters, examples, full and Online help for a cmdlet or function

        (Get-Command -Name Import-Csv).Parameters
        Get-help -Name Import-Csv -Examples
        Get-help -Name Import-Csv -Full
        Get-help -Name Import-Csv -Online

    Then use PoSH with the Excel object model to create what you are after.

    Just use your favorite search engine to find examples of that...

    'powershell excel automation'
    'powershell excel template'

    Introducing the PowerShell Excel Module
    'blogs.technet.microsoft.com/heyscriptingguy/2015/11/25/introducing-the-powershell-excel-module-2'

    PowerShell and Excel: Fast, Safe, and Reliable
    'blogs.technet.microsoft.com/heyscriptingguy/2014/01/10/powershell-and-excel-fast-safe-and-reliable'

Children
No Data