How can I define a name in Excel using Powershell?

I know how to reference existing names using the RANGE function but how can I create a new defined name using Powershell?
My specific case involves defining a name for a single cell with a workbook scope.  Just as if you were to right-click a cell in Excel and choose Define Name.
The closest I've gotten is the NAMES object for the workbook but when I "gm" that all I see is a method for delete - nothing for adding.
$xlsx = "c:\Sample.xlsx"
$excel = new-object -comobject Excel.Application
$xlb = $excel.Workbooks.Open($xlsx)
$xlb.names | gm

In Excel a Range has a name.  You can create a range and name it.  "Names" is just a list of the names that have been defined.
So what is it that you are asking?  If your spreadsheet has names this will find them for you.
Try this:
$xlb.names|select name
$r=$xlb.sheets.item(1).UsedRange
$r.Name='all'
# now do this again
$xlb.names|select name
So now you know everything about "names" or, as us old pros say "named ranges" like in the old  west.
¯\_(ツ)_/¯

Similar Messages

  • How can I give a name to excel sheet and open another one?

    Hello!
    I use CSVWriter for writing in excel file.
    I have 2 questions:
    1.     How can I give a name to a Sheet in excel file?
    2.     How can I save the first Sheet and open another one with a different name?
    Thanks!

    This is the equivalent in Apache POI which may or may not help. I've never used CSVWriter.
    HSSFSheet sheet1 = workbook.createSheet("sheet1Name");
    HSSFSheet sheet2 = workbook.createSheet("sheet2Name");Then you can use either sheet object to write your contents. Look at the documentation for CSVWriter that pertains to sheets as it should tell you how.

  • How can i define database name in oracle ADI

    Hai Friends,
    I am facing a problem when i am going to define database name in oracle ADI there is a error u can enter minimum 6 char database name but my database name is PROD it is only 4 char long. how can i define can i will change the database name. Please suggest me.
    If u have any query regarding oracle apps plse discuss with me.
    Many thanks
    Ghanshyam khetan

    Database is used internally by ADI and does not have any relationship to the name of your database.
    Using ADI I am able to create a database with the following:
    Name - My Wacky Database
    GWYUID and FNDNAM as usual
    Connect String - VIS
    I'm able to signon and work successfully with that definition. The connect string is more important in this scenario as that tells the networking layer which database to actually talk to. As you can see here mine is only three characters.

  • How Can Hide The File Name in URL Using Jsp

    I Want source code for Hiding The File name in url address using jsp.
    for example www.website/login.jsp is view but i want www.website/ only.

    Hi Praveen - how does that DEF would be determined?
    Have a look at the below blog for executing os commands
    SAP XI File Adapter OS Command Line Feature - Process Integration - SCN Wiki
    XI/PI: Command line sample functions
    Is there any problem in using the dynamic file name configuration??
    Message was edited by: Hareesh Gampa

  • How can i export the data to excel which has 2 tables with same number of columns & column names?

    Hi everyone, again landed up with a problem.
    After trying a lot to do it myself, finally decided to post here..
    I have created a form in form builder 6i, in which on clicking a button the data gets exported to excel sheet.
    It is working fine with a single table. The problem now is that i am unable to do the same with 2 tables.
    Because both the tables have same number of columns & column names.
    Below are 2 tables with column names:
    Table-1 (MONTHLY_PART_1)
    Table-2 (MONTHLY_PART_2)
    SL_NO
    SL_NO
    COMP
    COMP
    DUE_DATE
    DUE_DATE
    U-1
    U-1
    U-2
    U-2
    U-4
    U-4
    U-20
    U-20
    U-25
    U-25
    Since both the tables have same column names, I'm getting the following error :
    Error 402 at line 103, column 4
      alias required in SELECT list of cursor to avoid duplicate column names.
    So How can i export the data to excel which has 2 tables with same number of columns & column names?
    Should i paste the code? Should i post this query in 'SQL and PL/SQL' Forum?
    Help me with this please.
    Thank You.

    You'll have to *alias* your columns, not prefix it with the table names:
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id, b.id, a.val1, b.val1, a.val2, b.val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
      for rData in cData loop
    ERROR at line 18:
    ORA-06550: line 18, column 3:
    PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names
    ORA-06550: line 18, column 3:
    PL/SQL: Statement ignored
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id a_id, b.id b_id, a.val1 a_val1, b.val1 b_val1, a.val2 a_val2, b.val2 b_val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
    PL/SQL procedure successfully completed.
    cheers

  • I bought Numbers because my Excel files would not work with Mavericks. How can I import a non-functioning Excel file into numbers? (As of now, the file NAME transfers but data is not.) but

    I bought Numbers because my Excel files would not work with Mavericks. How can I import a non-functioning Excel file into numbers? (As of now, the file NAME transfers but data does not.)

    HI Dave,
    I'm surprised you get no message when you attempt opening the Excel document in Numbers.
    I'm assuming Numbers 3.1, since you are running Mavericks.
    Does the Numbers file that opens show any content?
    Does it contain a table?
    How large?
    Does it contain more than one tab (indicating more than one sheet)?
    Do those other tabs contain a table?
    Have you checked those tables for data content?
    There have been cases in the past of imported documents opening with white text on a white background, giving the appearance of containing nothing. Check for this by selecting a block of cells, then applying a Fill colour or a Text colour using the Format button (paintbrush).
    I'd also suggest attempting to open the Excel files using LibreOffice, which can be downloaded from the linked website.
    Regards,
    Barry

  • How can I set a name for a unknown place without moving it?

    I imported some photos with GPS information into iPhoto. I can see these photos on the map with one pin per photo, but every pin is tagged with "unknown place". All the photographs were taken on the same island, so I want to add the name of this Island to all pins.
    When I enter the name of the place, iPhoto doesn't know it (it seems like the built-in database is very small), so I have to go to the Google view. There I find the Island and can create a new place, but when I confirm it all photos will move to one pin which was defined in google - the original location is lost (and there is no undo function!!!).
    Questions:
    1. How can I assign a name to a pin without moving the pin?
    2. How can I restore the original place stored in the exif-information of the file?
    Thanks a lot,
    Jürgen

    Thanks for your answer, after playing around another while I understand that using GPS-data or Places are two things which cannot be used together in a reasonable way.
    Either I use the GPS pins, then they are at the right place, but then I just have the pins on the map without any names or grouping information.
    Or I create places - I can create one place per photo, but then I would have to manage around 10.000 places in a simple list view. So if I go on a city trip and take 100 photographs with GPS, then I either have to create 100 places, just to see the name of the city above the pin, or i have to group them to one single pin in the middle of the city. I think both doesn't make sense.
    Let's hope there are some improvements in upcoming versions.
    BTW: To go back to the original GPS-location is very easy. Just remove the assigned place by clicking on the 'x', then the GPS-location is used again immediately.
    Jürgen

  • How can I change column name in ALV table in WebDynpro ABAP?

    Hi Everyone,
    I have created an ALV table in WebDynpro ABAP. I have created a context node and added the required attributes there - for the ALV display.
    Now I want to change one columnn name of the ALV table.... Currently it is showing the description of the data element, which I don't want to show. I cannot create a new DE only for this purpose.
    Please let me know how can I change the name of the column.
    Regards

    Hi,
    This may help you to define your own column text in the ALV Table of webdynpro.
    see the below code.
    Here 'STATUS_ICON' is the column of the the output display of the ALV Table of webdynpro.
    "change the label of the report.
    DATA: lr_weeknum TYPE REF TO cl_salv_wd_column.
    CALL METHOD l_value->if_salv_wd_column_settings~get_column
    EXPORTING
    id = 'STATUS_ICON'
    RECEIVING
    value = lr_weeknum.
    SET THE LABEL OF THE COLUMN
    DATA: hr_weeknum TYPE REF TO cl_salv_wd_column_header.
    CALL METHOD lr_weeknum->get_header
    RECEIVING
    value = hr_weeknum.
    CALL METHOD lr_weeknum->set_resizable
    EXPORTING
    value = abap_false.
    hr_weeknum->set_prop_ddic_binding_field(
    property = if_salv_wd_c_ddic_binding=>bind_prop_text
    value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
    set the text of the column
    CALL METHOD hr_weeknum->set_text
    EXPORTING
    value = 'C Form'.
    regarads,
    balu

  • How can I get the name of an internal table in a textfield?

    Hi,
    I have defined an internal table in a program. Now I need the name of thist table (<u>NOT</u> the components!!!) in a textfield.
    Example for Data-Definitions in my Program:
    data: begin of it_tab occurs 0,
            feld1  like icon-id,
            feld2  like icon-name,
          end of it_tab.
    data: tabname(30) type c.
    How can I transfer the name "IT_TAB" into the field tabname?
    Thanks in andvance!

    No, it has to by 'dynamic'. I don't want to transfer it hard, because it should work for any internal table name.
    The requirement is: There are many function modules that have an input field TABLENAME. I have to give the tablename in the Form 'IT_TAB'.
    But I look for a possibiltity not to write:
    tabname = 'IT_TAB'.
    For DDIC-Tables its not a problem, but I dont know a way for internal tables.

  • How can we give two name for a single material ??

    Hi friends
    how can we give two name for a single material ??
    e.g.. if single material is sold to different customer by different names
    then how can we do that ??

    Yes
    you can achieve it thro CMIR in T code VD51
    Go to T code VD51 choose that customer and material combination and click on to its details blue lens on application tool bar
    In the screen which is coming ,enter your description in the CUSTOMER DESCRIPTION tab the second one and save
    Now create a sales order and see
    Your requirement will be fulfilled
    If a material is pen description is ball pen in material master and for customer A you have defined it as Pen 1 and description as Super ball pen in VD51
    If a material is pen description is ball pen in material master and for customer B  you have defined it as Pen 1 and description as  VerySuper ball pen in VD51
    Now in sales order the description will appear as Super ball pen for Customer A
    Now in sales order the description will appear as Very Super ball pen for Customer B
    Hence the material pen whose description is ball pen in MMR will appear as super ball pen for customer A and very super ball pen for customer B
    Hope you have checked the field info record in VOV8
    I have tried this tested this and getting it
    Regards
    Raja
    Edited by: ramanathan raja on Dec 8, 2008 5:54 PM

  • How can I define DB when I import

    Hi guys
    I use Oracle 9i.
    I created Database "DB_a" installing Oracle 9i then I added one more Database "DB_b" using wizard
    Both of user name is same.
    I was trying to import dumped file into "DB_a" but I couldn't
    Can I define DB name when I import?
    Or is there a way to set master DB in one DBMS?
    Thanks

    This is Oracle not SQL Server. Your questions are pure Microsoft and have almost nothing to do with Oracle.
    Please go to http://tahiti.oracle.com and read the concept docs and learn what a database is. Learn about
    SYS and SYSTEM. Learn about tablespaces and privileges. Also learn about the environment variables ORACLE_SID
    and ORACLE_HOME.
    It is far from apparent whether you have one database with two schemas or two databases or something else entirely.
    Nor is it obvious how many Oracle homes you may have created.
    What you may be asking about is the FROMUSER and TOUSER parameters.
    http://www.morganslibrary.org/reference/import.html

  • How can we define custom error page in protal application

    How can we define custom error page in protal application, like we define "jsp Error page " in JSPs

    Hi,
    Check these:
    Customization of Portal Runtime Errors and portal standard error codes
    http://help.sap.com/saphelp_nw04/helpdata/en/9a/e74d426332bd30e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ec/1273b2c413b2449e554eb7b910bce7/frameset.htm
    Regards,
    Praveen Gudapati

  • How can I define Double Click Processing in SAP Query ?

    The first question is : How Can I define drill-down for SAP Query report ?
    The second one :  How can I program Double Click in SAP Query report for Different columns like ALV Grid processing ?

    you can attach a repot or at tcode etc in an SAP query using report assignment in SQ01 but as far as i remember you cannot attach multiple reports.
    regards,
    khusro habib

  • How can I change the name of item in TableViewController iOS

    How can I change the name of item in TableViewController? I want to be able to change the title of an item if I added one. Code:
    //  ViewController.m
    //  Movie List
    //  Created by Damian on 20/02/15.
    //  Copyright (c) 2015 Tika Software. All rights reserved.
    #import "ViewController.h"
    @interface ViewController ()
    These outlets to the buttons use a `strong` reference instead of `weak` because we want
    to keep the buttons around even if they're not inside a view.
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *editButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *cancelButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *deleteButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *addButton;
    // A simple array of strings for the data model.
    @property (nonatomic, strong) NSMutableArray *dataArray;
    @end
    #pragma mark -
    @implementation ViewController
    - (void)viewDidLoad
        [super viewDidLoad];
         This option is also selected in the storyboard. Usually it is better to configure a table view in a xib/storyboard, but we're redundantly configuring this in code to demonstrate how to do that.
        self.tableView.allowsMultipleSelectionDuringEditing = YES;
        // populate the data array with some example objects
        self.dataArray = [NSMutableArray new];
        NSString *itemFormatString = NSLocalizedString(@"Movie %d", @"Format string for item");
        for (unsigned int itemNumber = 1; itemNumber <= 0; itemNumber++)
            NSString *itemName = [NSString stringWithFormat:itemFormatString, itemNumber];
            [self.dataArray addObject:itemName];
        // make our view consistent
        [self updateButtonsToMatchTableState];
    #pragma mark - UITableViewDelegate
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
        return self.dataArray.count;
    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
        // Update the delete button's title based on how many items are selected.
        [self updateDeleteButtonTitle];
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        // Update the delete button's title based on how many items are selected.
        [self updateButtonsToMatchTableState];
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        // Configure a cell to show the corresponding string from the array.
        static NSString *kCellID = @"cellID";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
        cell.textLabel.text = [self.dataArray objectAtIndex:indexPath.row];
        return cell;
    #pragma mark - Action methods
    - (IBAction)editAction:(id)sender
        [self.tableView setEditing:YES animated:YES];
        [self updateButtonsToMatchTableState];
    - (IBAction)cancelAction:(id)sender
        [self.tableView setEditing:NO animated:YES];
        [self updateButtonsToMatchTableState];
    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
        // The user tapped one of the OK/Cancel buttons.
        if (buttonIndex == 0)
            // Delete what the user selected.
            NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
            BOOL deleteSpecificRows = selectedRows.count > 0;
            if (deleteSpecificRows)
                // Build an NSIndexSet of all the objects to delete, so they can all be removed at once.
                NSMutableIndexSet *indicesOfItemsToDelete = [NSMutableIndexSet new];
                for (NSIndexPath *selectionIndex in selectedRows)
                    [indicesOfItemsToDelete addIndex:selectionIndex.row];
                // Delete the objects from our data model.
                [self.dataArray removeObjectsAtIndexes:indicesOfItemsToDelete];
                // Tell the tableView that we deleted the objects
                [self.tableView deleteRowsAtIndexPaths:selectedRows withRowAnimation:UITableViewRowAnimationAutomatic];
            else
                // Delete everything, delete the objects from our data model.
                [self.dataArray removeAllObjects];
                // Tell the tableView that we deleted the objects.
                // Because we are deleting all the rows, just reload the current table section
                [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
            // Exit editing mode after the deletion.
            [self.tableView setEditing:NO animated:YES];
            [self updateButtonsToMatchTableState];
    - (IBAction)deleteAction:(id)sender
        // Open a dialog with just an OK button.
        NSString *actionTitle;
        if (([[self.tableView indexPathsForSelectedRows] count] == 1)) {
            actionTitle = NSLocalizedString(@"Are you sure you want to remove this movie?", @"");
        else
            actionTitle = NSLocalizedString(@"Are you sure you want to remove these movies?", @"");
        NSString *cancelTitle = NSLocalizedString(@"Cancel", @"Cancel title for item removal action");
        NSString *okTitle = NSLocalizedString(@"OK", @"OK title for item removal action");
        UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionTitle
                                                                 delegate:self
                                                        cancelButtonTitle:cancelTitle
                                                   destructiveButtonTitle:okTitle
                                                        otherButtonTitles:nil];
        actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
        // Show from our table view (pops up in the middle of the table).
        [actionSheet showInView:self.view];
    - (IBAction)addAction:(id)sender
        [self.dataArray addObject:@"New Movie"];
        // Tell the tableView about the item that was added.
        NSIndexPath *indexPathOfNewItem = [NSIndexPath indexPathForRowself.dataArray.count - 1) inSection:0];
        [self.tableView insertRowsAtIndexPaths:@[indexPathOfNewItem]
                              withRowAnimation:UITableViewRowAnimationAutomatic];
        // Tell the tableView we have finished adding or removing items.
        [self.tableView endUpdates];
        // Scroll the tableView so the new item is visible
        [self.tableView scrollToRowAtIndexPath:indexPathOfNewItem
                              atScrollPosition:UITableViewScrollPositionBottom
                                      animated:YES];
        // Update the buttons if we need to.
        [self updateButtonsToMatchTableState];
    #pragma mark - Updating button state
    - (void)updateButtonsToMatchTableState
        if (self.tableView.editing)
            // Show the option to cancel the edit.
            self.navigationItem.rightBarButtonItem = self.cancelButton;
            [self updateDeleteButtonTitle];
            // Show the delete button.
            self.navigationItem.leftBarButtonItem = self.deleteButton;
        else
            // Not in editing mode.
            self.navigationItem.leftBarButtonItem = self.addButton;
            // Show the edit button, but disable the edit button if there's nothing to edit.
            if (self.dataArray.count > 0)
                self.editButton.enabled = YES;
            else
                self.editButton.enabled = NO;
            self.navigationItem.rightBarButtonItem = self.editButton;
    - (void)updateDeleteButtonTitle
        // Update the delete button's title, based on how many items are selected
        NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
        BOOL allItemsAreSelected = selectedRows.count == self.dataArray.count;
        BOOL noItemsAreSelected = selectedRows.count == 0;
        if (allItemsAreSelected || noItemsAreSelected)
            self.deleteButton.title = NSLocalizedString(@"Delete All", @"");
        else
            NSString *titleFormatString =
            NSLocalizedString(@"Delete (%d)", @"Title for delete button with placeholder for number");
            self.deleteButton.title = [NSString stringWithFormat:titleFormatString, selectedRows.count];
    @end

    Hey JB001,
    Sounds like you have more going on than just a simple issue with Home Sharing and more dealing with Wi-Fi syncing. Start with the article below and see if that may resolve it.
    iTunes 10.5 and later: Troubleshooting iTunes Wi-Fi syncing
    http://support.apple.com/kb/TS4062
    If it does not work out, then may I suggest contacting Apple for further assistance to walk you through it or just take that time that you were talking about to sort it out.
    Contact Apple Support
    https://getsupport.apple.com/GetproductgroupList.action
    Regards,
    -Norm G.

  • I had to restore my iPhone 4s and now my recent calls show only phone numbers instead of the contact's name.  How can I restore the names to my recent calls list?

    I had to restore my iPhone 4s and now my recent calls show only phone numbers instead of the contact's name.  How can I restore the names to my recent calls list?

    Are the contact details in your contacts app, the phone app uses the contact app to put names against telephone numbers.

Maybe you are looking for

  • Receiving By Products on basis of Production order

    In order to Produce Finished Good A I prepared a production order which consists of 4 types of Raw Materials. And The production order is  Type : Special At the time of This FG A  as per process I will get a By Product  BP1. This product also include

  • What more do I need to debug portlets?

    On my Win2k I have installed jDeveloper with the PDK-Wizard and have futhermore installed the OC4J extended with PDK (PDK_OC4J_EXTENDED.zip). According to the documentation it should be posible to do a standalone debugging (within the embedded OC4J)

  • I have PS5 and need to get a camera raw update but when I try it says serial

    I have PS5 and need to get a camera raw update but when I try it says serial # not valid, which of course it is a valid #. Does Adobe not allow me to upgrade raw on older software?

  • Bottom line - no way for 08 to keep proper clip dates?

    Right? I just need a definite "no" so I can download iMovie HD and install FinalCutExpress and start using these instead. Same clips in HD keep the recorded date...open project in 08, all clips have imported date. Absolutely insane. This has GOT to b

  • Better storage solution?

    There has to be a better option then what i am doing. I have 4 or sometime 5 FW drives connected with different projects. I do a lot of video work. Besides a 2TB drive- does anyone know of a solution under 1k that will store large video files and all