sheetjs icon indicating copy to clipboard operation
sheetjs copied to clipboard

Cells with German umlauts (ä, ö, ü) are ignored

Open mariusreusch opened this issue 8 years ago • 3 comments

Hi

We are trying to export the content of an ag-grid table to an xlsx file. We use the following steps (based on the ag-grid docs https://www.ag-grid.com/javascript-grid-excel/#sheetjs-custom-xlsx-export-example-without-styles):

const dataAsExcel = gridApi.getDataAsExcel(excelExportParams);
const workBook = XLSX.read(dataAsExcel, {type: 'binary'});
const xlsxContent = XLSX.write(workBook, {type: 'base64'});`

The table potentially contains German umlauts (dataAsExcel contains the umlauts)

<Cell>
   <Data ss:Type="String">The german umlaut ä</Data>
</Cell>

But as soon as we call XSLX.read all cells with umlauts are empty. The workBook field does not even contain entries for the affected cells.

Is there anything we are doing wrong?

Thanks in advance! Marius

mariusreusch avatar Oct 04 '18 12:10 mariusreusch

type should be "string":

const workBook = XLSX.read(dataAsExcel, {type: 'binary'});

An issue was raised against their documentation: https://github.com/ag-grid/ag-grid-docs/issues/180

reviewher avatar Oct 04 '18 14:10 reviewher

Works like a charm! Thanks.

mariusreusch avatar Oct 04 '18 15:10 mariusreusch

What must be added if type: 'array' is used?

XLSX.read(data, {type: 'array'});

samsandr avatar Jul 13 '20 10:07 samsandr