Embedded google drive ordering - google-drive-api

Can we sort google drive files to show the newest or last modified ones on the top ?? I only can see the list and grid option for showing files in iframe. If not , any advice or alternative solution for this issue that my client is facing it ?

Here is the documentation you needed to list files from the drive.
This method accepts the q parameter, which is a search query combining
one or more search terms. For more information, see the Search for
Files and Team Drives guide.
And you can actually sort it by using the parameter orderBy.
A comma-separated list of sort keys. Valid keys are 'createdTime',
'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural',
'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and
'viewedByMeTime'. Each key sorts ascending by default, but may be
reversed with the 'desc' modifier. Example usage:
?orderBy=folder,modifiedTime desc,name. Please note that there is a
current limitation for users with approximately one million files in
which the requested sort order is ignored.
You can also test by Try it now.

Related

Difference between recency & viewedByMeTime sort keys

What is the difference between recency & viewedByMeTime sort keys in the orderBy parameter of a file's list api
I wanted to get the most recently accessed files through the file's list api. I tried doing so by using recency desc in the orderBy parameter. Although the document suggests that there are mutiple keys based on which the sorting can be done, so what is the difference between recency & viewedByMeTime?
Is viewedByMeTime designed to be used in the context of shared drive?
Recency sort keys : sorts folders and files from the last modified to the first modified
ViewedByMeTime sort keys : as indicated by its name ViewedByMeTime sorts folders and files from the last viwed by the user to the first one.
When nothing is modified and viewed Recency and ViewedByMeTime sort have no effect and the order is kept as it is)

Google sheets importxml failure - Can't find the correct path to table from the link

I'm trying to retrieve a table which is updating twice per day. On other websites i was able to find the element but i saw that the way i see don't work on all websites where i tried.
In this case the issue is:
In google sheets using importxml, i can't find the correct path to table from the link or identify the element.
The website for this example is: http://lotopolonia.com/tabel/arhiva/index.php
1. I need to retrieve the dates and numbers.
2. They are updated twice per day and being updated in my sheet with adding just the last line at the top of the others. But this one after i solve the first one.
I looked at xpath tutorial from w3c and understood the syntax a bit.
The problem is how to identify correctly the elements and nodes in the inspector to retrieve the data i need.
Also, i've installed a chrome extension (XPath Helper) which shows xpath better that what i got from chrome.
I tried the following:
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row']/td[#class='colon2']")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row']/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='first_row'][1]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//*[#class='table_01']/table/tbody/tr[#class='first_row'][1]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[3]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[*]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row'][1]/child::td[*]")
The formula looks ok, without errors, but at all above requests i get the same result: imported content is empty
Unfortunately i ran out of ideas and how to interpret that elements...
Any ideea how to go on?
Cheers
How about this answer? I used //table[#class='table_01']/tr[position()>2] as a xpath. "A1" has http://lotopolonia.com/tabel/arhiva/index.php.
=IMPORTXML(A1,"//table[#class='table_01']/tr[position()>2]")
Using table[#class='table_01'], retrieve the table.
Using tr[position()>2], retrieve the dates and numbers.
Result :
Note :
If you want to retrieve the whole table, please use =IMPORTXML(A1,"//table[#class='table_01']/tr").
If this was not what you want, I'm sorry.

Query Google Admin User directory for multiple parameters

I'm trying to query Google Admin User directory on two parameters: name and orgName. I have tried several variations of the below, which does not work:
var userList = AdminDirectory.Users.list({
customer: 'my_customer',
maxResults: 100,
query: 'name:david AND orgName=hotel',
viewType: 'domain_public',
projection: 'full'
}).users;
... but I think it illustrates what I'm trying to do. My questions are:
1) Is this possible?
2) If I might push my luck, is it possible to query organization location? (I didn't see anything like this in the documentation...)
Have already consulted https://developers.google.com/admin-sdk/directory/v1/guides/search-users, did not find anything there.
The query does not support AND or OR operators, only one search term is allowed.
I'd suggest querying on the more specific (probably name) field and then filtering locally on the additional fields. So in other words, query=name:david and then look for hotel in the orgName field locally.
The query now supports only AND operator.
Multiple clauses are separated by whitespace and are implicitly joined
by an AND operator.
https://developers.google.com/admin-sdk/directory/v1/guides/search-users

How to Retrieve Large URL Json Data Set?

I am trying to obtain a data set via json and url, using SODA's API. The issue is that the data set is greater then 50K, and I need to sort the data set using multiple keys. Sorting by multiple keys is not something that is permitted by SODA's API. The question is how could I get around that?
Example (This table is small, but for illustrative purposes I have included it):
https://data.medicare.gov/resource/apyc-v239.json?$Limit=1000&$Order=measure_id
but once I attempt to add state to the order the API errors out.
The data set above is only 3800 recs, however there are other datasets with over 250000 recs, which require the same approach - sorting, then paging through the results...
Any assistance would be greatly appreciated.
Try the new API endpoint for that dataset: http://dev.socrata.com/foundry/#/data.medicare.gov/apyc-v239
It'll allow you to sort by multiple columns and there's no maximum for $limit on the new endpoints, so you can do stuff like this:
https://data.medicare.gov/resource/q7p2-jxeh.json?$order=state,measure_name&$limit=100000000

How do you get a list of files with Google Drive SDK

I have a list of file ids that I want to refresh with up-to-date metadata. I know there is a file/get method that I could call for each file, but it's obviously not the right way to deal with it if we have many files.
So I've looked for the file/list and its "q" parameter to make a search query. Unfortunately, it looks like it doesn't accept the "id IN (?, ?)" format.
So is there a clever way to do this?
You could wrap all of the file/get/put calls into a single batch.
https://developers.google.com/google-apps/documents-list/#batching_resource_operations_into_a_single_request
You can add all those files to a specific folder and then search for them using the parents field of a search query, as in:
'1234567' in parents
that returns all files that are contained in the folder with ID 1234567.
Is there a reason you need to download the items before you update them?
Given you have the file ID, you can simply PUT your changes.