Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I get data in 'display:table'd divs into Excel correctly

Tags:

html

css

excel

I have a series of divs organized in a neat table format using display: table, table-row and table-cell rules. It looks great, but I've been asked to support users that want to copy the text and paste into excel. In the past, we've had similar reports that are rendered in plain html tables (tr, td etc) and I guess excel knows what to do with that to bring it in appropriately, but for the styled divs they just make one long column (which is not exactly ideal for a useful report).

Is it possible to do this without resorting to an html table?

My question is a simple "Is it possible?". I already have an alternative solution, I just don't want to have to go down that path if there is a better way.

like image 520
Francisco Garcia Avatar asked Nov 19 '14 14:11

Francisco Garcia


People also ask

Which one of these Cannot be used to insert data into Excel?

The correct answer is Pressing the Esc key. It is a spreadsheet program for data analysis and documentation. It contains a number of rows and columns where the intersection of a column and a row is a "cell".

How do I pull data from a table in Excel?

When you need to find and extract a column of data from one table and place it in another, use the VLOOKUP function. This function works in any version of Excel in Windows and Mac, and also in Google Sheets. It allows you to find data in one table using some identifier it has in common with another table.


1 Answers

There is not really a way around this - Excel doesn't take CSS layouts into account so will not interpret it correctly.

Besides, if people are copying this data into Excel, it suggests to me it is actual tabular data so a <table> is probably the correct way to display it anyway - this is why the tag exists and is still valid in HTML5.

like image 112
Rhumborl Avatar answered Oct 01 '22 00:10

Rhumborl