Hello,

when i want to export a view in xls format, i get this error "The file format and extension of ".xls" don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?""
In the settings of the view, I have (in the xls format) checked "Provide as file". I renames my file with "%view.xls".

Have you a solution ?

Thanks for your help.

Comments

kumkum29’s picture

Apparently it seems that the problem comes from the newer versions of Excel (2007/2013)
With Openoffice there is no problem.

kumkum29’s picture

Hello,

The problem is it a bad encoding of the xls file?
This above post may be a solution ?
https://www.drupal.org/node/1269994

Thanks for your help.

kumkum29’s picture

After to have analysed the code source of my xls file (generated by views), i see in the header this code:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>

Then do I have specified a specific code for xls files as in the example below?

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
    <head>
        <meta http-equiv=Content-Type content="text/html; charset=windows-1252"/>
        <meta name=ProgId content=Excel.Sheet/>
        <meta name=Generator content="Microsoft Excel 11"/>

If yes, can i resolve and change this code in a template file or other file ?

Thanks for your reply.

kumkum29’s picture

After to have change the header of the xsl template, i get still this error.
The problem seems not to come of the metas.
Perhaps, we do have to use the xml export to create the xls file?

KristineC’s picture

Hi kumkum29, have you found a solution to this? I'm getting the same error.

jelle_s’s picture

Same here. Opening it anyway displays the file just fine, it's just an annoying message to our customers when they export their data.

delacosta456’s picture

hi

Same too with this is issue .. Please has anyone found a solution

jackenmail’s picture

Hello,

This issue is because of HTML tables in Views data export module. Some explanation is available here

steven jones’s picture

Status: Active » Closed (won't fix)

Sorry for the lack of attention to your issue, please accept my apologies.

Drupal 7 is going to be end-of-life'd by the community in approximately 1 month.

As such, I am closing all non-critical looking, non-PHP compatibility issues for Views Data Export to tidy up the issue queues and reduce the noise. You can read about this on #3492246: Close down Drupal 7 issues.

If you feel like this issue has been closed by mistake, please do comment about re-opening it.
If you feel like the ticket is still relevant for the 8.x-1.x version of the module, then please search for a duplicate issue first, and if there really isn't one (and you've looked properly) then change the version on the ticket and re-open.

Thanks to everyone involved in this issue: for reporting it, and moving it along, it is truly appreciated.
The Drupal community wouldn't be what it is today without your involvement and effort, so I'm sorry that we couldn't get this issue resolved. Hopefully we'll work together in a future issue though, and get that one resolved :)