Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export data in excel format #3800

Closed
debayan31 opened this issue Jun 18, 2015 · 37 comments
Closed

Export data in excel format #3800

debayan31 opened this issue Jun 18, 2015 · 37 comments

Comments

@debayan31
Copy link

Is this possible to export grid data in excel format?

Currently we can export data in CSV and PDF format.

@PaulL1
Copy link
Contributor

PaulL1 commented Jun 18, 2015

CSV can be imported to Excel. Excel format is not a documented format, so no we cannot export to it.

@debayan31
Copy link
Author

Excel means .xls file.

There may be a issue if I export a grid data which contains comma,semicolon or any special character then after impoting this to Excel, It may not open in desired format.

@PaulL1
Copy link
Contributor

PaulL1 commented Jun 18, 2015

There may be an issue, but the csv format should quote or escape those things appropriately. As noted, .xls isn't a documented/open format, so it's not really possible to build something that creates xls. The normal method is to create csv.

@JLLeitschuh
Copy link
Contributor

Actually .xls is a documented/open format:
jqwidgets actually supports xls output: http://www.jqwidgets.com/jquery-grid-export-to-excel/
The format is documented here: http://blogs.msdn.com/b/brian_jones/archive/2005/06/27/433152.aspx

That being said, someone would have to write an implementation to create an exporter for this.
We could alternatively have an optional dependency upon something like this:
http://jordiburgos.com/post/2013/javascript-export-to-excel.html

@PaulL1
Copy link
Contributor

PaulL1 commented Jun 20, 2015

That's interesting, wasn't aware of that. I do think that csv suits most purposes though - exporting to .xls just adds complexity I would have thought.

@uguryilmaz
Copy link

that would be awesome if someone implements this functionality. most of the companies uses excel export. and most of the grid components of various companies have this export function. i think ui-gird must have this function as well.

@JLLeitschuh
Copy link
Contributor

We are open to pull requests to add enhancements.

@JLLeitschuh JLLeitschuh added this to the Future milestone Jun 30, 2015
@sunz7
Copy link

sunz7 commented Oct 23, 2015

+1

1 similar comment
@bjaraujo
Copy link
Contributor

+1

@PaulL1
Copy link
Contributor

PaulL1 commented Nov 18, 2015

This is a useful request, but not really in the current roadmap. We have far too many good ideas in the repository already, giving the impression that we have a project riven with defects.

Accordingly, I am leaving the enhancement tag on this, but closing it. If someone would like this functionality, we'd welcome a pull request that adds it.

@PaulL1 PaulL1 closed this as completed Nov 18, 2015
@Mastanka
Copy link

+1

6 similar comments
@sidd06
Copy link

sidd06 commented Jan 5, 2016

+1

@Incognito-Nemo
Copy link

+1

@KennedyIhe
Copy link

+1

@laviyatziv
Copy link

+1

@dishant8
Copy link

dishant8 commented Apr 6, 2016

+1

@ganesh-vellanki
Copy link

+1

@bjaraujo
Copy link
Contributor

Maybe saving the html as xls would be enough?

Example from: http://jordiburgos.com/post/2013/javascript-export-to-excel.html

somedata.xls

<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=UTF-8"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>undefined</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>
    <tbody><tr>
        <td>100</td>
        <td>200</td>
        <td>300</td>
    </tr>
    <tr>
        <td>400</td>
        <td>500</td>
        <td>600</td>
    </tr>
</tbody></table></body></html>

@chrisruddick
Copy link

+1

4 similar comments
@anasanzari
Copy link

+1

@rbaras
Copy link

rbaras commented Jun 2, 2016

+1

@Scuttman
Copy link

+1

@yogeshkumarpa
Copy link

+1

@oyiadom
Copy link

oyiadom commented Sep 12, 2016

+1

A nice compromise might be to add the tab-delimited format (TSV) as an export option. This would work around the comma-related issue that @debayan31 mentioned with CSV files but still enable users to open the file in Excel. I suspect changing the delimiter from a comma (",") to a tab ("\t") in the source code is trivial. From what I have seen, Microsoft is using the ".txt" file extension (e.g. as opposed to ".tsv") as the standard for tab-delimited files (and, in general, for files delimited with anything other than a comma).

Reference
https://support.office.com/en-us/article/Import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba

@csvan
Copy link
Contributor

csvan commented Oct 20, 2016

I solved this by converting the standard CSV export to .xlsx via this lib: http://excelbuilderjs.com/. It is relatively simple for most cases.

@lreisoliveira
Copy link

@csvan http://excelbuilderjs.com is down

@lreisoliveira
Copy link

lreisoliveira commented Dec 6, 2016

About export to xls
+1

For example: this Query works fine http://jsfiddle.net/jqwidgets/6HRU8

@csvan
Copy link
Contributor

csvan commented Dec 6, 2016

@lreisoliveira the maintainer shut it down. It was fine when I posted that.

@rawatshailender
Copy link

+1

1 similar comment
@Romender
Copy link

Romender commented Feb 4, 2017

+1

@gokhancelik
Copy link

gokhancelik commented Apr 24, 2017

I can achive using jx-xlsx https://github.com/SheetJS/js-xlsx
and FileSaver.
Running plunkr here

http://plnkr.co/edit/DVhIUgGD04yDXtjp7ReW

@feliperugai
Copy link

@gokhancelik that's exactly what I needed. It works like a charm. Thank you!

@alejandrorossi
Copy link

+1

@dcm93
Copy link

dcm93 commented Oct 11, 2017

@gokhancelik I am trying to use your excel exporter service but I can't figure out what is your property "e" in the range object in the addCell function. Thanks in advance!

@nashnight
Copy link

SheetJS Angular demo shows ui-grid import and export: https://github.com/SheetJS/js-xlsx/tree/master/demos/angular

@bobisch
Copy link

bobisch commented Mar 15, 2018

Apparently this functionality now exists in ui-grid proper, since v4.0.11 (2017-11-20), through the exporterMenuExcel and exporterExcel* options (due to merging in PR #6199 (Excel export), per @csvan or @monster910).

In fact, it appears to be enabled by default, even if the required support modules are not available.
To work it requires the "excel-builder" npm module and maybe some other dependencies. That could be the source of some other issues reported - #6581, others?

The big problem, as mentioned above by @lreisoliveira, is that excel-builder is no longer supported.
It seems to be pretty dead. See https://github.com/stephenliberty/excel-builder.js and the big No longer maintained statement at the top.

Question: should we be looking at a replacement for excel-builder? Possibly SheetJS/js-xlsx - https://github.com/SheetJS/js-xlsx

Alternatively: Someone should take over excel-builder support or one of the (several) existing forks could be promoted as official?

Also, the "enhancement" and "waiting-response" tags and milestone are probably not appropriate for this issue anymore - it's confusing because this thread comes up in searches and the reason for closing it makes it sound like it's still an issue.

@monster910
Copy link
Contributor

XLSX is a good choice as it also has import/parse capabilities. It lacks the capabilities of excel-builder without a license.

All open source is roll your own. Feel free to create a new branch and work on a new Excel export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests