header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Reformatting Excel Columns
Last Post 07 Jun 2010 12:56 PM by dgolliner. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
dgollinerUser is Offline
New Member
New Member
Posts:3
Avatar

--
07 Jun 2010 12:56 PM
    I'm a newbie to powershell, and have been given the duty of learning powershell so that I can create a file loading process into sql.  I'm wanting to create a script that opens csv files in excel 2007, reformat the columns to all "text" so that when i save the file, every field is has a text qualifier. Could use a little help trying to point me in the right direction when it comes to the reformatting portion. Here is the excel connection code:

    $xlExcel8 = 56
    $Excel = New-Object -ComObject excel.application
    $Excel.visible = $False
    $Excel.displayalerts=$False
    $WorkBook = $Excel.Workbooks.Open("C:\users\dgolliner\desktop\item_vend_pkg_factor_temp.csv") $WorkSheet = $Workbook.worksheets.Item(1)
    $WorkSheet.UsedRange.FormatConditions.ToString ?????????? 
    $Resize = $WorkSheet.UsedRange 
    $Resize.EntireColumn.AutoFit()
    $WorkBook.SaveAs("C:\users\dgolliner\Desktop\ivpf.csv", $xlExcel8)
    $Excel.quit()

    Thanks
    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