How to use spread.getSheetFromName() when using .sjs file format?

Posted by: tyler.franklin on 6 January 2023, 3:57 pm EST

    • Post Options:
    • Link

    Posted 6 January 2023, 3:57 pm EST

    Does spread.getSheetFromName() work when using an .sjs file? I am able to use spread.getSheet() but not spread.getSheetFromName(). Is there a way I can use spread.getSheetFromName() or is this not possible when using an .sjs file? See below for code.

    	var spread = GC.Spread.Sheets.findControl(host);
            console.log(spread.getSheet(0)); // This method words
            console.log(spread.getSheetFromName("Summary")); // This method does not work

    Is

  • Posted 9 January 2023, 12:26 am EST - Updated 9 January 2023, 12:31 am EST

    Hi,

    We are sorry but we are unable to replicate the issue at our end. Could you please share a working sample that replicates the issue so that we could investigate it further and help you accordingly.

    Regards,

    Avinash

  • Posted 9 January 2023, 12:20 pm EST

    Good morning,

    Thanks for the quick reply. I figured out that I am trying to call the object method before the object is fully defined. So I am trying to call spread.getSheetFromName() before my workbook is fully open.

    Thank you for the help.

  • Posted 9 January 2023, 3:59 pm EST - Updated 9 January 2023, 4:04 pm EST

    I am still unable to use spread.getSheetFromName() like I was prior to using an .sjs file.

    Please refer to the attached images. My spread instance has 13 sheets in the spread.sheets property. But I can only access the first sheet (spread.sheets[0]) by using spread.getSheetFromName() or spread.getSheet(). The result is undefined is I use spread.getSheetFromName() or spread.getSheet() to access any sheets besides spread.sheets[0].

  • Posted 10 January 2023, 8:38 am EST

    Hi,

    Please make sure you have -passed the correct name to verify tis you may use the name method spread.getSheet(0).name(). further if you still face any issues please share a working sample that replicates the issue so that we could investigate it further.

    regards,

    Avinash

  • Posted 10 January 2023, 12:29 pm EST

    Awesome. My issue is resolved. Thank you for the help.

Need extra support?

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

Learn More

Forum Channels