Custom name added from code isn't shown in Name Box when selecting range

Posted by: asaf.shechter on 24 July 2023, 12:04 pm EST

    • Post Options:
    • Link

    Posted 24 July 2023, 12:04 pm EST - Updated 24 July 2023, 12:10 pm EST

    Hello,

    we are adding custom name with the following code :

    sheet.addCustomName(…)

    it works fine ,

    the issue is that when adding custom name from code and then selecting the range in the spreadsheet it’s not updating the Name Box component,

    for example custom name “visual1” was added but when selecting the relevant range the Name Box is not updating ,

    when clicking on the dropdown and selecting visual1 manually it does work,

    I repeat this happens only when adding custom name from code.

    Is it a known issue and is there a workaround?

    (last image is when selecting a range in the spreadsheet which doesn’t work, images 1 and 2 is when selecting the custom name directly which works)

    Thanks.

  • Posted 25 July 2023, 6:59 am EST

    Hello,

    The name of the custom name is not reflected in the name box when selecting the cell range of the custom name in the sheet because the sheet name needs to be specified in the range formula string when a custom name is added to the sheet. The sheet name is used to map custom names with sheets internally.

    Please refer to the attached code snippet and sample for more understanding.

    sheet.setArray(0, 0, [['a', 'b'], [1, 2]]);
    sheet.addCustomName('range', 'Sheet1!$A$1:$B$2', 0, 0);

    sample: https://jscodemine.grapecity.com/share/qOjFD-njA0GQzvBXeY51JA/?IsEmbed=false&Theme=Unset&PreviewDirection=0&IsEditorShow=true&IsExplorerShow=true&IsPreviewShow=true&IsConsoleShow=true&IsRunBTNShow=false&IsResetBTNShow=false&IsOpenInCodemineBTNShow=false&PanelWidth=20&PanelWidth=50&PanelWidth=30&defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}

    Please let us know if you face any issues.

    Regards,

    Chandan

  • Posted 25 July 2023, 7:53 am EST - Updated 25 July 2023, 8:22 am EST

    Hi,

    it seems to work fine now ,

    (we wrapped the sheet name like this ‘Sheet1’ in case you have ! at the end of the sheet name , so now it will look something like this : ‘Sheet1!’!$A$1:$B$2

    Thanks!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels