Reputation: 147
I'm trying to import some facebook data into spreadsheets.
The request
https://graph.facebook.com/v2.6/{user id}?fields=name&access_token=1{my token}
Gets me
{
"name": "user",
"id": "numeric id"
}
When I import it to spreadsheets with:
=IMPORTDATA(https://graph.facebook.com/v2.6/{user id}?access_token={my token}
)
On the cells, I get {"name": "user"
in one cell and "id": "numeric id"
in another. But I only need the "name" value, How can I target just that value, in only one cell as I have no use for the second value.
Upvotes: 2
Views: 439
Reputation:
Since you want only one cell from the imported range, which happens to be its upper left corner, the array_constrain
function can help:
=array_constrain(importdata("..."), 1, 1)
Generally, the 2nd and 3rd arguments of array_constrain
determine how many rows and how many columns you want to keep.
You can also get rid of "name": at the beginning by using the text processing functions such as left
, right
, regexreplace
, etc. For example, wrapping the previous formula in
=regexreplace( ... , "^\S+: |""", "")
will get rid of "name": and of the quote marks around the name.
Upvotes: 1