
This simple project allows you to Export records into excel sheet directly from Standard List view of any objects.Find more details in my blog check here
 To add the Export to excel button follow the below setps, below example for 'Account' object- Go to Setup –> Accounts –> Buttons, Links and Actions
- Click ‘New Button or Link'
- Enter Label, Name and select display type as ‘List Button’
- Content source as “Onclick Javascript” and paste the below code
//Getting List Name
var listview = document.getElementsByName('fcf')[0];
var listName = listview.options[listview.selectedIndex].text;
//Getting List Id
var listId = document.getElementsByName("fcf")[0].value;
var ObjectName = 'Account'; //Action : Enter the Object API Name
//Passing ListId,ObjectName and ListName to Visualforce page
window.open("apex/exportStandardListView?Object="+ObjectName+"&listid="+listId+"&listName="+listName,"myWindow");
- Go to Setup->Remote Site –> New
- Add the Name and in the URL enter the domain name of your org
- Then click save