Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm using a DVWP in MOSS 2007 to display some data and using a jQuery library called table2CSV to be able to allow users to export the data on a button click. This is all working fine, the data is popped up in a window that will allow users to select all the contents and add it to Excel.

On the table2CSV page, they show an option to allow the data to be sent to a PHP server to return the data as an actual file.

I've got no knowledge of PHP, but I'd like to provide similar functionality. Using jQuery, what would my options be to make the SharePoint server send back an actual CSV file?

share|improve this question

4 Answers 4

There's really nothing built into SharePoint to handle this, you'd just need to pursue some custom asp.net development. You would need to write a custom webservice that would accept comma separated data in a post request, and then transform that data into a file. You could host that webservice in iis on the same machine as your sharepoint setup.

share|improve this answer

Could you use the jQuery SP Services lib to save the values to a CSV file to a library in SharePoint and then direct them to that file?

I've never used SP Services but I have heard great things about it.

share|improve this answer

I would suggest exporting to excel and then have them save as CSV. Here is some client side code I wrote to override the "Export to Excel" button on the ribbon(just the Excel part). It takes xml, but might make a good starting point.

openExcel = function(xmlDoc){
        var Excel = new ActiveXObject("Excel.Application"),
            book,
            map,
            range,
            listObj;

        Excel.DisplayAlerts = false;
        Excel.Visible = true;
        book = Excel.Workbooks.Add();
        map = book.XMLMaps.Add(xmlDoc);
        range = book.ActiveSheet.Range("A1","I1").Select();
        listObj = book.ActiveSheet.ListObjects.Add();
        listObj.ListColumns(1).XPath.SetValue(map, "/Users/User/@PreferredName");
        listObj.ListColumns(2).XPath.SetValue(map, "/Users/User/@AccountName");
        listObj.ListColumns(3).XPath.SetValue(map, "/Users/User/@EmployeeNumber");
        listObj.ListColumns(4).XPath.SetValue(map, "/Users/User/@Title");
        listObj.ListColumns(5).XPath.SetValue(map, "/Users/User/@Office");
        listObj.ListColumns(6).XPath.SetValue(map, "/Users/User/@Manager");
        listObj.ListColumns(7).XPath.SetValue(map, "/Users/User/@ManagerAccountName");
        listObj.ListColumns(8).XPath.SetValue(map, "/Users/User/@ManagerTitle");
        listObj.ListColumns(9).XPath.SetValue(map, "/Users/User/@ManagerEmployeeNumber");
        listObj.ListColumns(1).Name = "Name";
        listObj.ListColumns(2).Name = "Account Name";
        listObj.ListColumns(3).Name = "Employee Number";
        listObj.ListColumns(4).Name = "Title";
        listObj.ListColumns(5).Name = "Office";
        listObj.ListColumns(6).Name = "Manager";
        listObj.ListColumns(7).Name = "Manager Account Name";
        listObj.ListColumns(8).Name = "Manager Title";
        listObj.LIstColumns(9).Name = "Manager Employee Number";
        book.XmlImportXml(xmlDoc, map,range);
    }
share|improve this answer
    
This is moss, ergo no ribbon –  PirateEric May 26 '12 at 13:35
    
When I posted this, I was thinking of a button on the page. I just used the ribbon because it was there and already said "export to Excel". –  Blue Murphy May 26 '12 at 15:29
up vote 0 down vote accepted

Functionality abandoned and continuing with the status quo.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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