GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ehsanshrz/angular-csv: Helper library for create CSV file in Angular 5

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

94 Commits
94 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.travis.yml
.travis.yml
 
 
Angular-csv.spec.ts
Angular-csv.spec.ts
 
 
Angular-csv.ts
Angular-csv.ts
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
custom.d.ts
custom.d.ts
 
 
karma.conf.js
karma.conf.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

angular_logo

angular-csv | Export to CSV in Angular

npm version GitHub license Angular Node npm

A helper library for creating and downloading CSV files in Angular.

Installation

npm install --save angular-csv

Example

import { AngularCsv } from 'angular-csv/dist/Angular-csv';

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' "
  }
];

new AngularCsv(data, 'My Report');

API | AngularCsv(data, filename, options?)

Option Default Description
fieldSeparator , Defines the field separator character
quoteStrings " Character used to quote string fields
decimalseparator . Defines the decimal separator character. Set to "locale" to use the locale-sensitive representation
showLabels false When true, uses headers to create a header row
showTitle false When true, adds the title as the first line
title 'My Report' Title shown at the top of the file when showTitle is true
useBom true Prepends a BOM character (\ufeff) to improve Excel compatibility
useHeader false When true, only fields whose keys are listed in headers are exported
useObjHeader false When true, uses objHeader keys as export order and values as column labels
noDownload false When true, disables automatic download and returns the formatted CSV string instead
headers [] Array of column header labels (or field keys when useHeader is true)
objHeader {} Object map of data keys to custom column labels, also controls export order
nullToEmptyString false When true, converts null values to empty strings

Options Example

const options = {
  fieldSeparator: ',',
  quoteStrings: '"',
  decimalseparator: '.',
  showLabels: true,
  showTitle: true,
  title: 'Your Title',
  useBom: true,
  noDownload: false,
  headers: ['First Name', 'Last Name', 'ID'],
  useHeader: false,
  nullToEmptyString: true,
};

new AngularCsv(data, 'filename', options);

Retrieving the CSV String

Pass noDownload: true to suppress the automatic download and get the raw CSV back:

const options = { noDownload: true };
const csv = new AngularCsv(data, 'My Report', options).getCsvData();
console.log(csv);

Credits

  • sn123
  • arf1980
  • rob-moore

About

Helper library for create CSV file in Angular 5

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.