We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid Toolbar CsvExport

Hello,

I have exported the content of the grid to a CSV file but it separates the columns with a ',' and I want them to be separated by a ';'. How can I do that?

Looking forward to hearing from you, 

Ane Perez de Nanclares

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team January 29, 2019 05:11 AM UTC

Hi Ane, 

Greetings from Syncfusion. 

Query: I have exported the content of the grid to a CSV file but it separates the columns with a ',' and I want them to be separated by a ';'. 
 
We have analyzed your query but we are not sure about your requirement. So please provide the below details, it will help us provide better solution as soon as possible. 

  1. Where does the grid columns separated with the ‘,’?
  2. Please provide the exact steps to achieve your scenario?
  3. Please reproduce it in the below provided sample?
 
 
Please get back to us for further assistance. 
 
Regards, 
Thavasianand S. 



AN Ane January 29, 2019 08:32 AM UTC

Hello, 

Here are the answers to the questions you made. If you need something else please tell me and I will send you all the information that you required as soon as possible. 
  • Where does the grid columns separated with the ‘,’? When you export the content of the grid to a CSV file the columns are separated by a ','. Here it is one example:
 
  • Please provide the exact steps to achieve your scenario?
<ejs-grid #grid id='Grid' [dataSource]='data' [toolbar]='toolbar' [allowExcelExport]='true' (toolbarClick)='clickHandler($event)'>

In the .ts:

import { GridComponent, FilterSettingsModel, IFilter, ExcelExportService, ToolbarItems } from '@syncfusion/ej2-angular-grids';
import { ClickEventArgs } from '@syncfusion/ej2-angular-navigations';

@Component({
selector: 'app-system-logs',
templateUrl: './system-logs.component.html',
styleUrls: ['./system-logs.component.css'],
providers: [ ExcelExportService]
})
export class ----Component implements OnInit {

toolbar: ToolbarItems[];
@ViewChild('grid')
grid: GridComponent;

constructor() {}

ngOnInit() {
this.toolbar = ['CsvExport'];
}

getContent() {
this.data = [
{ ------------------------------ },
{ ------------------------------ },
{ ------------------------------ }
];
}

clickHandler(args: ClickEventArgs): void {
console.log('Grid: ', args.item.id);
if (args.item.id === 'Grid_csvexport') {
this.grid.csvExport();
}
}

}


TS Thavasianand Sankaranarayanan Syncfusion Team January 30, 2019 05:14 AM UTC

Hi Ane, 

We would like to inform you that by default a CSV (comma-separated values) file contains the values in a table as a series of ASCII text lines organized so that each column value is separated by a comma from the next column's value and each row starts a new line. Please refer the general documentation link below, 

So if you open the .csv, by default it will display as a comma separated value. Please get back to us if you need further assistance. 

Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon