I came across to an interesting query. When we open a document library or a list AllItems.aspx we have an option to export the data into spreadsheet. However there is no direct link given. We do not have any URL for the Export to Excel option that comes under actions menu.
However, when you want to place a link for Export to excel in your web part or your webpage, then here is a way to go for it.
{siteurl}/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={GUID of list}&View={GUID of view}&CacheControl=1
As you can see all you need to do is replace the respective place holders.
{siteurl} is your site url.
{GUID of list} is the GUID of the list for which you want to export the data to spreadsheet.
{GUID of view} is the GUID of the view for which you want to export the data to spreadsheet.
Where will you get these GUIDs? Well, you will find it when you click on List Settings.
And then click on the view name for which you want the data
You can use the same formula at places where there is no option to export to spreadsheet. For example, if you see on people and group permission page, you will not find this. You the same formula and you will be able to export it to the spreadsheet.
That’s it. Your job is done.