alhazmy13 / angular-csv-ext Goto Github PK
View Code? Open in Web Editor NEWThis project forked from javiertelioz/angular2-csv
Helper library for create CSV file in Angular.
License: MIT License
This project forked from javiertelioz/angular2-csv
Helper library for create CSV file in Angular.
License: MIT License
Is there a way to exclude a column from export option ? and also can i make header as bold?
There should be a method to handle Null values as giving out null seems abrupt in an excel file, Is there a way to do it or else
Can you publish 1.0.0 to npm so we can get past this npm warning?
npm WARN [email protected] requires a peer of @angular/core@^5.0.0 but none is installed. You must install peer dependencies yourself.
I upgrading to Angular 8 and I get the following error
Package "angular5-csv" has an incompatible peer dependency to "rxjs" (requires "^5.5.2", would install "6.5.2").
Do you support Angular 8?
Hi ,
I want to download grid data as csv on click of button like :-
public downloadCsv() {
//new Angular5Csv(this.data, 'My Report');
}
Now tell me how to do this bez it is giving issue on new keyword. [unused expression, expected an assignment or function call (no-unused-expression)]
Hi,
I was figuring out if we can add graphs/charts in Excel using Angular5-csv. How can we add graph/charts to excel using Angular5-csv? Is there an option to insert graphs?
Thanks.
Trying to create an CSV file with multiple headers. Is there a way for this feature using this package.
Any help will be greatly appreciated.
Thanks.
ng update @angular/cli @angular/core
Package "angular5-csv" has an incompatible peer dependency to
"@angular/core" (requires "^5.0.0" (extended), would install "7.0.1").
Package "angular5-csv" has an incompatible peer dependency to
"@angular/http" (requires "^5.0.0" (extended), would install "7.0.1").
Incompatible peer dependencies found. See above.
solution: npm remove angular5-csv
import { AngularCsv } from 'angular-csv-ext/dist/Angular-csv';
instead of refering to Dist every time, how can i use it as npm package ?
Upgrade support for Angular 6.x please!
Hi,
I have faced with next error:
TS7016: Could not find a declaration file for module 'angular5-csv/Angular5-csv'.
Could you add declaration in d.ts file ?
Thank you!
after doing a new build on my application my jenkins build throws:
error TS2307: Cannot find module 'angular5-csv/Angular5-csv'.
When I roll back to 0.2.10 it works just fine.
Why Angular 5? is it frozen to 5? Can I use it with Angular 4, or 6 or 7?
when exporting a dataset that has a float or decimal, it appears that this is truncating the numbers:
for example, we have a dataset field that follows a 7.5 pattern i. e 1234567.12345 in the csv, it appears like this '
231380.0023
where the above number should be 231380.00231
or if the number after the decimal place starts with 0, it completely removed everything after the decimal, for example,
it should be this:
2071090.00005
but getting this:
2071090
our dataset even though it looks like a float, this pattern is actually a string from the api
The show label option as per the read-me file is supposed to print the headers with the key values of but it does not do anything
I have a custom component in Angular5
application named data-graph
component. In that custom component i received data which i am exporting to Csv using Angular5Csv
angular package which is downloading instantly on button click correctly. Here is that clicked function code from data-graph.component.ts
import { Angular5Csv } from 'angular5-csv/dist/Angular5-csv'
exportToCsv() { let fileName = this.sensors[0].meter.name + 'Sensors Report'; this.sensorsData.map(item => { if (item._id) { delete item._id; } item.Time = new Date(item.date).toLocaleString(); delete item.date; }) this.customData = this.sensorsData; let fields = Object.keys(this.customData[0]); var options = { fieldSeparator: ',', decimalseparator: '.', title: '', showLabels: true, showTitle: true, noDownload: false, headers: fields, }; new Angular5Csv(this.customData, fileName, options); let anotherCsv = new Angular5Csv(this.customData, fileName, options); }
This exports a csv with data and headers very correctly in this format :
`F1 C1 P1 Time
10.0 12.54 9.32 2/26/2019, 2:08:22 PM
08.32 12.54 2.32 2/26/2019, 2:08:24 PM
05.01 12.54 5.32 2/26/2019, 2:08:27 PM
11.0 12.54 6.32 2/26/2019, 2:09:22 PM`
But i want to add another header with one row like this :
`Min Max Average
F1 05.01 11.0 09.32
C1 02.66 15.04 10.65
P1 2.32 6.32 3.44`
`F1 C1 P1 Time
10.0 12.54 9.32 2/26/2019, 2:08:22 PM
08.32 15.04 2.32 2/26/2019, 2:08:24 PM
05.01 04.33 5.32 2/26/2019, 2:08:27 PM
11.0 02.66 6.32 2/26/2019, 2:09:22 PM`
How can i achieve this result using angular5Csv
?
Hi Everyone,
I use this library with angular-8.2.3 and this is working fine, but i get this script-error on app bootstrapping:
Uncaught ReferenceError: exports is not defined at Angular-csv.js:2
I was importing this Library over angular.json:
{
"projects": {
..
"architect": {
..
"build": {
..
"scripts": [
..
"node_modules/angular-csv-ext/dist/Angular-csv.js"
]
}
}
}
}
Did not found a easy solution for that until now :-(
Any recommendations?
Thanks,
Robin
var options = {
fieldSeparator: ',',
quoteStrings: '"',
decimalseparator: '.',
showLabels: true,
showTitle: true,
useBom: true,
noDownload: false,
headers: ["Reason of Duplication", "Model Record No"]
};
If you add any methods on Array/Object prototype then the for in
loop from getBody()
method will try to export it.
https://github.com/alhazmy13/angular-csv-ext/blob/master/Angular-csv.ts#L136
As a fix I would suggest using the hasOwnProperty
method to avoid iterate over inherited properties, or maybe use Object.keys()
and iterate over them to fully avoid for in loop
How to reproduce:
Array.prototype.myFunct = function () { return this; }
const data = [1, 2, 3];
new AngularCsv(data, 'My Report');
// the output will be a CSV file with
// 1, 2, 3, function () { return this; }
For moment, as a hack workaround I override the toString()
method for prototype functions:
Array.prototype.myFunct = myFunct;
function myFunct() { return this; }
myFunct.toString = () => '';
I have set showLabels as true but still not showing header row.
Hi, in my data I have a DateTime column that is getting serialized into a JSON string. Is there any way to de-serialize this in the module please as when you open the file in Excel or Numbers it is stuck in the JSON format?
I am using angular5-csv version 0.2.11 and while trying to upgrade to Angular 8, it throws below error:
Package "angular5-csv" has an incompatible peer dependency to "@angular/core" (requires "^5.0.0" (extended), would install "8.0.0").
Also, seems like angularcsv-5 has dependency on rxjs 5.x. ON upgrade page, Angular team has suggested to migrate to rxjs 6.x for angular 8.
Package "angular5-csv" has an incompatible peer dependency to "rxjs" (requires "^5.5.2", would install "6.5.2").
Thanks.
options = {
fieldSeparator: ",",
quoteStrings: '"',
decimalseparator: ".",
showLabels: true,
showTitle: true,
headers: ["First Name", "Last Name", "ID"]
};
new Angular5Csv(this.data, "My Report", this.options);
this.data = [
{
name: "Test 1",
age: 13,
average: 8.2,
approved: true,
description: "using 'Content here, content here' "
},
{
name: "Test 2",
age: 11,
average: 8.2,
approved: true,
description: "using 'Content here, content here' "
},
{
name: "Test 4",
age: 10,
average: 8.2,
approved: true,
description: "using 'Content here, content here' "
}
];
CSV will be like
My Report
0,1,2
"Test 1",13,8.2,TRUE,"using 'Content here, content here' "
"Test 2",11,8.2,TRUE,"using 'Content here, content here' "
"Test 4",10,8.2,TRUE,"using 'Content here, content here' "
Hi, I would like to add a hyperlink as a value to a column I'm creating, anyway doing it? Can't see it in the documentation
Hey, I was wondering what this library's algorithm is for ordering columns when exporting. On my end it seems to be random. Is there a way to assign a specific order for them to appear in in the CSV file?
If there is nested structure in the data, how will it be transferred into csv?
var data = [{
name: "name1",
nested: {
nestedName: "nestedName1"
}
}];
Hi ,
I am Getting "My Report" on file which is downloading but it is not anywhere .I want to remove that and add some other part which will come dynamically from Api .
From Where i Can do this ?
generateCsv function is private attribute
How can I get csv string?
Versions
"@angular/core": "^6.0.2",
"@angular/http": "^6.0.2",
"rxjs": "^6.0.0",
Repro steps
npm i
Observed behavior
npm WARN [email protected] requires a peer of @angular/core@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/http@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of rxjs@^5.5.2 but none is installed. You must install peer dependencies yourself.
Desired behavior
No peer dependency warnings/errors from npm by using the angular5-csv.
Mention any other details that might be useful
"peerDependencies": {
"@angular/core": "^5.0.0",
"@angular/http": "^5.0.0",
"rxjs": "^5.5.2"
},
I can use angular5-csv in Angular 6, but give this npm warn because of above peerDependencies...
Hi I'm a user of this csv module and really appreciate you developed this angular5-csv module. It helps a lot.
Yesterday I'm experiencing error with this module. It said cannot find this module. It causes my company's website down in production. So I'm asking is there a way to prevent this from happening ? Or could I do any configuration of webpack for the failure tolerance ?
Thanks
Hi,
It looks like your index.js in the NPM module is currently set to be your test example, as follows:
const Angular5Csv = require('./dist/Angular5-csv.js').Angular5Csv;
const data = [
{
name: "Test 1",
age: 13,
average: 8.2,
approved: true,
description: "using 'Content here, content here' "
},
{
name: 'Test 2',
age: 11,
average: 8.2,
approved: true,
description: "using 'Content here, content here' "
},
{
name: 'Test 4',
age: 10,
average: 8.2,
approved: true,
description: "using 'Content here, content here' "
},
];
new Angular5Csv(data, 'My Report');
So any call to the library is just downloading that test data! A bit of showstopper...
How to download the file?
my code
var options = {
fieldSeparator: ',',
quoteStrings: '"',
decimalseparator: '.',
showLabels: true,
showTitle: true,
title: 'Your title',
useBom: true,
noDownload: true,
headers: ["id", "title", "sort_order"],
nullToEmptyString: true,
};
this.myfile = new Angular5Csv(response, 'My Report', options);
This is a small issue..
Currently example on https://www.npmjs.com/package/angular5-csv has import { Angular5Csv } from 'angular5-csv/Angular5-csv';
but github page and what actually works is import { Angular5Csv } from 'angular5-csv/dist/Angular5-csv';
In npmjs import statement is wrong please replace with correct import statement
How do I change the missing column string from 'undefined' to blank.
I have nullToEmptyString: true,
CSV output is
Region,2014,2015,2016,2017,2018,2019,2020
"Africa",0.1,undefined,0.2,0.3,0.2,0.9,undefined
I am passing a long string in the title in the options.
How can I break the line so my Title should be displayed in the multiple lines?
Happy coding!! Thanks!
probably is me but in the csv all the row are in one cell how i can divide in multiple cell like
a b c
name surname email
// // //
not only in one
possibile?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.