API Find Slice Reference

I tried to obtain SLICE data using AppSheetApi in GAS.

Scripts are below.

new_slice : Sliced data table name

 

 

 

const url = 'https://api.appsheet.com/api/v2/apps/' + appId + '/tables/' + new_slice + '/Action';
    
    const payload = {
      'Action':'Find',
      'Properties':{
        'Locale':'ja-JP',
        'Timezone': 'Tokyo Standard Time',
        'Selector': 'SELECT(new_slice,TRUE)'
      },
      'Rows':[]
    };

    const params = {
      'contentType': 'application/json',
      'headers':{
        'ApplicationAccessKey': apiKey
      },
      'method':'post',
      'payload':JSON.stringify(payload)
    };

    let appsheetData = UrlFetchApp.fetch(url,params);

 

 

 Data could be acquired, but the data to be obtained was partially different.

 

ASAssist - ใƒ—ใƒญใ‚ธใ‚งใ‚ฏใƒˆ็ทจ้›†่€… - Apps Script (2).png

Key is correct. However, the corresponding value is incorrect. It seems to refer to the value of the table before slicing.

Please fix if it is a bug.

thank you for reading.

Solved Solved
0 6 626
1 ACCEPTED SOLUTION

Oh I see.

The help article for the "Find" API method makes no mention of working on a Slice. So I wouldn't really expect it work flawlessly.Although it still might be good to send this to support.

For now, I'd suggest calling the API on the base Table, and using your script to pull only the required columns.

View solution in original post

6 REPLIES 6

"Key is correct. However, the corresponding value is incorrect. It seems to refer to the value of the table before slicing."

Which value is incorrect? Slices don't change any values, so not sure what you're referring to. What exactly is the issue?

Thank you for your reply.

Let's take an example of the value of json.

ASAssist - ใƒ—ใƒญใ‚ธใ‚งใ‚ฏใƒˆ็ทจ้›†่€… - Apps Script (2).png


The part of the red frame does not clearly match the Key.
The [solar_palnat_id] at the top is text, but the datetime are displayed.

Fit OM Inspection Data - Google ใ‚นใƒ—ใƒฌใƒƒใƒ‰ใ‚ทใƒผใƒˆ.png

I compared json with the original spreadsheet data source.
Then the data seemed to match.

 

Therefore, it is possible that the data in the original data table was extracted instead of the data in the column specified in the slice.

Thanks.

Yes, I see the inconsistencies between the 2 screenshots. Maybe you need to regenerate your Table?

Although this:

"I compared json with the original spreadsheet data source.
Then the data seemed to match.

Therefore, it is possible that the data in the original data table was extracted instead of the data in the column specified in the slice."

...still doesn't make sense. The json data matches the original data source? What is the second screenshot of though, is that not the original data source?

 

 

The second screenshot is the original data table.

[new_slice] sliced this table.

[new_slice] uses "Custom" of "Slice Columns" to delete some columns.

Of the [new_slice] json data called by the API, the key is correct, but the value matches the value in the original data table.

I want the API to extract the values of the columns selected in the slice.

Sorry for my poor English ...

Oh I see.

The help article for the "Find" API method makes no mention of working on a Slice. So I wouldn't really expect it work flawlessly.Although it still might be good to send this to support.

For now, I'd suggest calling the API on the base Table, and using your script to pull only the required columns.

https://help.appsheet.com/en/articles/2680586-reading-records-from-a-table#:~:text=The%20Select%20ex....

 

As I mentioned here, I thought that slice could be used.

Maybe it means that slice is effective only as a filter function.

 

I don't need it right away, so
I will post it as feature idea.

First of all, I try to challenge with a script!

 

Thank you, Marc_Dillon!

 

Top Labels in this Space