1

Can anyone tell me that how can I export SharePoint search result for a particular keyword(which I passed in SharePoint search box web part) through REST API?

2
  • do you want the know about search query using REST API or the export functionality? – ThinkB4Code Jun 15 '17 at 12:27
  • I want export to excel functionality. – trickytechie Jun 15 '17 at 12:32
1

There may be some JS API available which can do it in better way, but i prefer the old school way to export html tabular data into excel.

<html>
    <body>
        <table id="xyz">
            <tr>
                <td>ABC</td>
                <td>DEF</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
            </tr>
        </table>
        <a id="exportData" href="" download="text.xls">Export</a>
    </body>
</html>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
<script>
    $(document).ready(function(){
        var tableHTML = document.getElementById('xyz').outerHTML.replace(/ /g, '%20');
        $('#exportData').prop('href', ('data:application/vnd.ms-excel, ' + tableHTML));
    })
</script>

The only condition is, your data need to be in tabular format and when you are saying export to excel, it must be satisfying the condition.

1
  • My data is not in table format. I am using default view of SharePoint Search result to display. – trickytechie Oct 16 '17 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.