Take the 2-minute tour ×

I would like to output a table to a webpage. The table is stored in an excel sheet (xls).

Is it possible to use xslt for this? The table is the cells are in this range: A26 - P36 (16 columns and 11 rows)

If an exmaple file is need here is a link: http://finans.opengate.dk/media/6704/2010-01-13.xls

Update: A daily file is uploaded. And I would like to automatically show a table from the latest xls-file using xslt. If some C# is needed to convert it from excel to something else (XML?) that is fine. It is done in the CMS Umbraco and that is why I hope to use XSLT since that is the way to show things in Umbraco, through xslt makroes.

BR. Anders

UPDATE with answer (based on answers below): No, it is not possible to read xls-files using xslt. If needed then one has to save excel sheet in another format xml or html. Or one will need a real programming language to read the excel file.

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

XSLT is mostly used to convert XML from one dialect to another, not to convert xls files to html.

If you just want to do this manually, you can save your worksheet as HTML directly in excel.

It is not clear from your question if you want to do this programmatically, and if so using what programming language.

share|improve this answer
Thanks for your feedback. I just updated question with the info that I would like to have it done automatically. And that if xslt cannot read xls then some C# code can be used for the job or just to convert xls to xml –  Tillebeck Jan 29 '10 at 10:41
add comment

You can use ADO.net to access cells in an excel file, similar to a DB query. This is a bit lighter than trying to use Excel automation objects.


share|improve this answer
thanks for the link. I will come back to it. But is it correct that it is about code going into the excel sheet? If possible in any way I would love to make the xslt ablo to retrieve the data from an xls-file. But if not possible another solution must be made. –  Tillebeck Jan 29 '10 at 10:44
As said above, you could save your worksheet as another format, but otherwise you will need to do some programming. Of course, you could just server the excel file directly... –  Paddy Jan 29 '10 at 11:00
add comment

SpreadsheetGear for .NET can read Excel files and display them in a DataGrid as shown in the Excel to DataGrid sample on this page:

    // Create a workbook from an Excel file
    String ssFile = Server.MapPath("files/spiceorder.xls");
    SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook(ssFile);
    // Get a DataSet from an existing defined name
    DataSet dataSet = workbook.GetDataSet("orderrange", SpreadsheetGear.Data.GetDataFlags.FormattedText);
    // Bind a DataGrid to the DataSet
    DataGrid1.DataSource = dataSet;

SpreadsheetGear can also render png/gif/jpg images from cell ranges or charts as demonstrated here.

You can download the free trial here if you want to try it yourself.

Disclaimer: I own SpreadsheetGear LLC

share|improve this answer
Thanks for the tip. I cannot do any C#, so some company will have to do that part. I will send them the link to this thread so they will get to know your product. Hope sales are doing well ;-) –  Tillebeck Feb 1 '10 at 8:49
add comment

Your Answer


