Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $excel = New-Object -ComObject excel.application
- #$excel.visible = $True
- $wb = $excel.Workbooks.Add()
- $ws = $wb.Worksheets.Item(1)
- $ws.Cells.Item(1,1) = 'Titre'
- $ws.Cells.Item(1,2) = 'Indice'
- $ws.Columns.Item('a').HorizontalAlignment = -4108
- $ws.Columns.Item('b').HorizontalAlignment = -4108
- $ws.columns.item('b').NumberFormat = "@"
- $row = 2
- echo "Rechrche en cours ..."
- ls -directory -r -path "scan*" | % {
- $name = $_.name.Replace("__","_")
- $parts = $name.Split("_")
- if ( $parts.Count -gt 2 ) {
- #$namedoss = $parts[1],$parts[2] -join "_"
- #echo $namedoss >> lt.txt
- $ws.Cells.Item($row,1) = $parts[1]
- $ws.Cells.Item($row,2) = $parts[2]
- $row += 1
- }
- }
- $outputpath = join-path -Path $env:USERPROFILE -ChildPath "desktop\excelltest.xlsx"
- echo "Enregistrement sur $outputpath ..."
- $wb.SaveAs($outputpath)
- $excel.Quit()
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement