Solved

Powershell / Excel  set Data and import to Excel - Could anybody assist to complete?

Posted on 2014-09-11
8
190 Views
Last Modified: 2014-09-15
Dear experts,

below you see the part of my code so set and import different custom attributes to variable company shorts
1. I want to write this informations to 4 columns called "CA4" for Cust4 (Column Q - 17), "CA8" for cust8 (18)
"CA10" for cust10 (19) and "CA14" for cust14 (20)
2. Can i use "Default" for all shortcut not explizit listed?

pls see also comments:

$comp = $actRow.Item(3).Value2
       $cust4, $cust10 , $cust14 = 'N', $comp.SubString(0,3)
   
    switch -wildcard ($comp)
    {
      'LST*'       { cust4 = 'F'; cust8 = 'LST'; cust10 = 'LST' }
      'GRIN*'   {                   cust8 = 'LS'; cust10 = 'LS' }
     default   {   cust4 = 'K'; cust8 = 'Z'; cust10 = 'LSBU' }       ;Can i use "default" for all other not listet?
   

  ; or should every default listet as below?


    }
    if ('CXC', 'DXC', 'EMC', 'KUH', 'DER', 'CVT', 'KCC', 'CCS', 'RTT', 'REQ', 'TZU', 'RZU', 'KPAUS' -notcontains $comp)
    {
      $cust10 = 'LF'
      $cust4 = 'D'
      $cust14 = 'DE'}
       
    }
    $actRow.Item(16).Value2 = $cust4
    $actRow.Item(17).Value2 = $cust10
    $actRow.Item(18).Value2 = $cust14
}

$WorkBook.Save()
$objExcel.Quit()

$comp = $actRow.Item(3).Value2
       $cust4, $cust10 , $cust14 = 'N', $comp.SubString(0,3)
   
    switch -wildcard ($comp)
    {
      'LST*'       { cust4 = 'F'; cust8 = 'LST'; cust10 = 'LST' }
      'GRIN*'   {                   cust8 = 'LS'; cust10 = 'LS' }
     default   {   cust4 = 'K'; cust8 = 'Z'; cust10 = 'LSBU' }       ;Can i use "default" for all other not listet?
   

  ; or should every default listet as below?


    }
    if ('CXC', 'DXC', 'EMC', 'KUH', 'DER', 'CVT', 'KCC', 'CCS', 'RTT', 'REQ', 'TZU', 'RZU', 'KPAUS' -notcontains $comp)
    {
      $cust10 = 'LF'
      $cust4 = 'D'
      $cust14 = 'DE'}
       
    }
    $actRow.Item(16).Value2 = $cust4
    $actRow.Item(17).Value2 = $cust10
    $actRow.Item(18).Value2 = $cust14
}

$WorkBook.Save()
$objExcel.Quit()

Open in new window

0
Comment
Question by:Mandy_
  • 5
8 Comments
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 40318040
If you know the customer number, you can use an OFFSET property of the range, assuming that you have a range pointing to CA1.
0
 
LVL 2

Author Comment

by:Mandy_
ID: 40319616
I've requested that this question be deleted for the following reason:

I solved that by myself
0
 
LVL 2

Author Comment

by:Mandy_
ID: 40319628
I'm using Excel vlookup function from data sheet with all attributes
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 2

Author Comment

by:Mandy_
ID: 40323551
I've requested that this question be closed as follows:

Accepted answer: 0 points for Mandy_'s comment #a40319628

for the following reason:

I'm using Excel vlookup function from data sheet with all attributes
0
 
LVL 2

Author Comment

by:Mandy_
ID: 40319649
vlookup instead of complicate powershell coding
Mandy-vlookup.xlsx
0
 
LVL 2

Author Closing Comment

by:Mandy_
ID: 40323552
thanks
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now