header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
How to specify the column for horizontal axis while drawing an excel chart from a csv file using powershell
Last Post 26 Aug 2010 09:45 AM by templebar. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
templebarUser is Offline
New Member
New Member
Posts:3
Avatar

--
26 Aug 2010 09:45 AM
    Hello powershell gurus, I am a newbie to powershell and is trying to create an excel chart from a csv file using powershell. The powershell code is as follows $excel = New-Object -comobject "Excel.Application" $workbooks = $excel.Workbooks.Open("C:\PTest\cpu1.txt") $ws = $workbooks.WorkSheets.Item(1) $range = $ws.usedRange #Now add our charts to the workbook $workbooks.Charts.Add() | out-null $workbooks.ActiveChart.chartType = [microsoft.office.interop.excel.xlChartType]::xlLine $workbooks.ActiveChart.SetSourceData($range) $workbooks.SaveAs("C:\PTest\test.xlsx") $excel.Quit() The csv file has two columns timestamp,"Utilization" 1282744080,6.1730450000e+00 etc. When I produce the graph, ideally I want the timestamp on the horizontal axis and Utilization on the vertical axis.What I am getting is both these columns on the vertical axis, drawn against the row counter on the horizontal axis. Any help much appreciated. Thanks, S.
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer