none
Write to excel file using open xml and powershell RRS feed

  • Question

  • Hello Experts,

    We are planning to automate some of the tasks at server side where MS Office is not installed. Hence we have installed Open XML SDK. Unfortunately I didn't find any helpful info to read/write excel files using open XML & PowerShell.

    Please let me know for any documentation or examples.

    Thanks in advance.

    Regards,


    Thursday, February 7, 2019 6:38 PM

All replies

  • I didn't find Open XML examples or documentation. Hence I've installed import-excel powershell module and merged csv files into xlsx.

    Here is the code snippet for other's benefit:

    $f1 = import-csv $srcdir$iUsers
    $f1 | Export-excel -Path $trgt -WorksheetName InternalUsers
    $f2 = import-csv $srcdir$iAttribute
    $f2 | Export-excel -Path $trgt -WorksheetName IUserAttribute
    $f3 = import-csv $srcdir$eUsers
    $f3 | Export-excel -Path $trgt -WorksheetName ExternalUsers
    $f4 = import-csv $srcdir$eAttribute
    $f4 | Export-excel -Path $trgt -WorksheetName EUserAttribute


     
    Friday, February 22, 2019 5:33 PM