Jump to content

Extracting Worksheet IDs from Workbooks


Recommended Posts

Posted

I would like to extract worksheet and workbook IDs from multiple workbooks into a dataframe. Does someone know how to do this with a SPy query? I will be using the dataframe to reconstruct URLs that will be used in another application to quickly open these SEEQ worksheets.

On top of that, with the reconstructed URLs, would there be a way to specify the start/end time of the plots?

  • Seeq Team
Posted

Hi JC-XOM,

You can extract the worksheet ID using Seeq API. Here's an example:

workbooks_api = seeq.sdk.WorkbooksApi(spy._login.client) #calling the workbook API
workbook_id = '0EEC3FB8-2D63-ECB0-86E9-47A0DC532F31' #replace the ID with your own workbook ID
worksheets = workbooks_api.get_worksheets(workbook_id=workbook_id).to_dict()['worksheets'] #calling the worksheets under the workbook ID
worksheets

The start/end time will follow the existing worksheets.

  • 2 weeks later...
Posted

Thanks Nuraisyah, that worked with some tinkering.

As for manipulating the worksheet start/end times, how can I accomplish that? Would that be possible with Seeq API?

  • Seeq Team
Posted

For that I'd suggest using our Workbook URL Builder, which allows you to build new worksheets as well as modify existing worksheets using URLs with query parameters. I'd recommend reading through the linked KB article, but for example you could take an existing worksheet and load it with a new display range (last 2 weeks) using the following URL:

https://your-instance-url/workbook/builder?workbookName=WORKBOOK_ID&worksheetName=WORKSHEET_ID&displayStartTime=*-14d&displayEndTime=*

 

Posted

I found the right way to handle this from the URL, without the need to build a new workbook every single time the link is accessed, plus I plan to make these trends widely available to folks who will only be assigned rights to View these worksheets. This opens the worksheet in View-only mode as well, which will be helpful for my use case.

https://your-instance-url/view/WORKSHEET_ID?displayRangeStart=YYYY-MM-DDTHH:MM:SSZ&displayRangeEnd=YYYY-MM-DDTHH:MM:SSZ

I did look through the documentation but did not find mention of this is while going through the KBs - perhaps you could point me to the right place which contains a full list of these URL query parameters which are useable with '/view/'? I am trying to generate the trends with displayRangeStart= *-1hr (now minus 1 hour) and displayRangeEnd = * (now) however it does not work for me.

Besides that, is there a way for me to also set the timezone from the URL query parameters? 

  • Seeq Team
Posted

The URL Builder  does not necessarily generate new workbooks. If you specify a workbook ID and worksheet ID that already exists that a user has access to (can be read-only), you can create a URL that will open a worksheet in read-only view with a specified display range. The two keys here are to specify viewMode=view and freshStart=false for it to work as expected:

https://your-instance-url/workbook/builder?workbookName=0EED4BAB-44DF-EEC0-981A-AC7357B32994&worksheetName=0EED4BAB-48D9-FFD0-9DED-68487D309251&displayStartTime=*-14d&displayEndTime=*&viewMode=view&startFresh=false

Since this is a fully documented and supported feature I'd suggest going this route. As for timezone, the URL Builder will take it from a user's profile (which is detected from the browser).

Are you facing any particular issues with this option?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...