Excel Web Query: Replace query URL with value from another table - excel

Currently, the colorful table is using a fixed URL. I want to send a user-defined, complete URL string to this web query, and have it update whenever it's changed.
The large white box is a pulldown list (AN358):
User can choose a new location:
Which brings up a new URL (AN362) which points to a different web table (always same format). In my case, the colorful table does not change since it's currently a fixed link.
To the right, I converted the blue cells into a new table called "TableYear1" (AN361):
In power editor, here is the existing query "Year 1":
In advanced editor, I tried to replace the web link highlighted here:
With the underlined value here. I know the syntax/usage is probably wrong...it's just to illustrate what I want to accomplish.

try replacing the code with this
Source = Web.Page(Web.Contents(Excel.CurrentWorkbook(){[Name="TableYear1"]}[Content]{0}[URL1])),
in your example you pass a string (table name), while you need a reference to that table

Related

Get filtered data from Google Sheets API

I am using nodeJS for fetching the data from google sheet and the URL looks like :
var url = `https://sheets.googleapis.com/v4/spreadsheets/${sheet_key}/values/Sheet2!A1:J20?key=${google_API_key}`
From this, I am only getting the data between A1 to J20 So now I have two questions :
How do I get all the rows from the sheet or last 10.
How do I apply a structured query filter like: where name == "Himanshu"
Edited :
For question 2: what I have done is using Query Language Reference (Version 0.7) / structured queries, which is referenced by #Tanaike. This is how my URL looks
like now and its working as well.
https://docs.google.com/a/google.com/spreadsheets/d/${sheet_key}/gviz/tq?tq=select%20*%20where%20B%20%3D%20'Himanshu'&key=${google_API_key}
But the issue is it's returning me the string something like this which I cant able to parse.
google.visualization.Query.setResponse({"version":"0.6","reqId":"0","status":"ok","sig":"509770406","table":{"cols":[{"id":"A","label":"Response Path","type":"string"},{"id":"B","label":"Name","type":"string"}]}})
How about this answer?
A1
You can retrieve all rows using sheet name as the range as follows.
var url = `https://sheets.googleapis.com/v4/spreadsheets/${sheet_key}/values/Sheet2?key=${google_API_key}`
A2
You can use the query like where name == "Himanshu" using Query Language. In order to use this, please share the Spreadsheet as follows.
On Google Drive
On the Spreadsheet file
right-click -> Share -> Advanced -> Click "change" at "Private - Only you can access"
Check "On Anyone with the link"
Click "Save"
At "Link to share", copy URL.
Retrieve file ID from https://docs.google.com/spreadsheets/d/### file ID ###/edit?usp=sharing
About Query Language, you can see the detail information at Query Language Reference.
If I misunderstand your question, I'm sorry.
Edit 1 :
When you want to retrieve the formatted data, please use tqx=out:. In your case, tqx=out:json is used. It seems that it's default. For example, you want csv, it's tqx=out:csv. Also you can use tqx=out:html. I think that tqx=out:csv may be useful for your situation.
https://docs.google.com/a/google.com/spreadsheets/d/${sheet_key}/gviz/tq?tqx=out:csv&tq=select%20*%20where%20B%20%3D%20'Himanshu'&key=${google_API_key}
Edit 2 :
In order to retrieve JSON data of spreadsheet, please do as follows.
On Spreadsheet
Click File -> Publish to the web
Publish as web page.
URL 1
You can retrieve the values of spreadsheet as JSON using the following URL.
https://spreadsheets.google.com/feeds/cells/${sheet_key}/od6/public/values?alt=json
od6 means 1st page of spreadsheet.
URL 2
If you want to retrieve other pages, please confirm using the following URL.
https://spreadsheets.google.com/feeds/worksheets/${sheet_key}/public/basic?alt=json
Note :
If error occurs when you access the URLs, please confirm whether the spreadsheet is published again.

Search Display Template in Tabular Form with specified columns

What is the starting point to create a search display template in a table format and be able to specify which columns you want to display. Presently, the default format only shows the title, description, and link in a 3 row list. I would like to change this to have title, description, link in 3 columns (table format) and be able to add or remove more columns.
What I have managed till now is create a search page for Tasks, that only searches for files of that specific content type. Now I want to be able to decide which columns are shown in the resulting view and if possible show them in a tabular format.
I was thinking about finding a similar template and try edit the HTML to make it look as I want it. Is there a similar template? Or perhaps a ready template which I missed?
Thanks!
There was indeed a similar template, very similar to what I needed:
Displaying SharePoint 2013 Search Results in a Table
The table template html files are also provided for under an MIT License.

Excel Pivot Table: Open URL with Pivot Table Settings as Parameter

I have an Excel file that connects to our customer database. In there, I can break down the number of customers using a Pivot table. For instance, I would see that there are X female customers of age 18-25 who live in the US.
What I'd like to do now, is take this number X, turn it into a link that, when clicked, opens a web browser window to a web application which is also connected to the same customer database and does something with this specific customer segment (i.e. builds a contact file for a newsletter application etc.)
I have no idea how this can be done. I assume that it may be possible to add a custom button to the Excel toolbar which would extract all the current pivot table settings so that I can send them as URL parameters to my web app. Is this possible? If so, how is it done?
Can you help me in the right direction please?
Thx a lot!
No need to create buttons if you dont have to.
You can use the HYPERLINK() function and concatenate the URL out of text and cell values.
So for example the URL for this page in an excel cell would be:
=HYPERLINK("https://stackoverflow.com/questions/"&A1&"/excel-pivot-table-open-url-with-pivot-table-settings-as-parameter")
Where cell A1 = 18843796
18843796 being the id for this question. You can do this with as many parameters as you want.
This will create a clickable URL which will automatically open your default browser.

SharePoint Web Parts can not be connected via hyperlink fields

In short:
I'm trying to filter an XSLTListViewWebPart based on what is selected in another XSLTListViewWebPart. Using a String field as connection this is working fine. Using a hyperlink field no data is displayed.
In more detail:
I have two lists, say Accounts and Projects. Both have a hyperlink field accountURL.
All accounts have different accountURLs. Different projects can have the same value for accountURL. Both are displayed on a page using the XSLTListViewWebPart.
The simple goal is to filter the Projects list based on which item is selected in the Accounts list using the accountURL field. So I established a web part connection using the acountURL as a filter. Alas, when an item in the Accounts list is selected no items are showwn in the Projects list although I double checked that there are matching values.
When using a string field instead of a hyperlink field for accountURL everything works like a charm. Problem is, I need the hyperlink field.
Is this desired behaviour? Do you have any suggestions for a workaround?
(I already tried converting the hyperlink field to a string field via a calculated column which did not work out either.)
All was and is to be done in the web interface or SP-Designer. Coding a WSP is not an option for this problem. As I'm not quite familiar with the correct terminus technicus I use field and column interchangeably.
All help is greatly appreciated.
Ben
Someone on the Microsoft forum suggested the following workaround which does its job well:
Add a hidden text column to both lists.
Use a workflow which is triggered on item creation and update to copy the value of the hyperlink column to the hidden text column.
Connect both webparts using the hidden column as filter.
Nonetheless, I still wonder whether it is possible to use hyperlink columns or other special columns for filtering. I also had the problem that I cannot use a person column as lookup.
Does anyone know if whether there ist some kind of overview
which column types can be used for filtering/formulas/lookup/...?
Cheers,
Ben

Sharepoint: Person column in custom list

I have a Person field in my custom list. I want to have a view that will show multiple fields from that Person instead of the one I had to choose when creating the Person column.
So basically I want to have one column for Person and then in the view see Name, title, email, phone. All of those are valid choices but I can only pick one right now.
I really want to avoid typing in the username lookup for each column I choose to display.
This is SP 2007
It sounds like you need to create a custom fieldtype (with a fieldcontrol) that inherits from the userfield but in viewmode renders out the different columns you need. Is that something along the lines you are looking for?
http://www.sharepointblogs.com/nicksevens/archive/2007/08/31/create-custom-field-types-for-sharepoint.aspx
Note: This link is broken
You probably want a Computed Field. Note that this is not a Calculated Column. A Computed Field is what is used to display the same data is different ways. In SharePoint there is a Title field, but there is also a "Title (linked to item with edit menu)" computed field as well as a "Title (linked to item)" computed field.
See midway down this link for more details. I'm not sure if it will have all of the power that you need, but if it does it is almost certainly what you are looking for if you don't mind getting into the Schema XML file a little.
Could you use a DataView web part for this? If it's just a question of viewing the data that might be suitable.
Came across this thread and thought I'd add a tip. This suggestion is clearly not for every use case, but may work well in situations where you're managing a list rather than allowing manual inputs (verified to work with SP 2013):
Create a spreadsheet with columns to match your SharePoint list that contains multiple profile fields. (for example: name, phone number, email address)
In the spreadsheet, enter the same email address in all of the person/group field types in that row. (e.g., boss#company.com, boss#company.com, boss#company.com)
Select and copy the row(s) you wish to transfer to SharePoint.
In SharePoint, change the list view to "Quick Edit" and paste the row(s) into the grid.
SharePoint will process each field and convert the email address to the profile value you selected during the list setup.

Resources