Exporting to excel or .csv

Tags: #<Tag:0x00007f8b26b9df58>

Hi,

I am working on handson with angular 7. I am not able to use the export to csv plugin as it is giving me a ‘handsonTable has no default export’ error. When i try to correct it by seeing other examples suggested by you, it is in Javascript and that is again giving an error with respect to ‘hotId’. I dont know what else to do.

Hey @bhavrao8

here’s an example for Angular and export to .csv functioality triggered by an external button click https://stackblitz.com/edit/angular-f6xgws?file=src/app/app.component.ts

1 Like

Hi Aleksandra,

I tried this in my code but the ‘hotinstance’ is going as ‘undefined’ and hence it is not working as desired. I checked out other questions on this topic too but I am not finding the right fix. Also, in my handson table i am not creating it with ‘Handsontable.helper.createSpreadsheetData’. I am hardcoding the column headers and data with variable rows populated with data received from the database. Can that be a problem? Can you please suggest some fix for ‘hotinstance’ being undefined, as i’ve tried multiple fixes but none worked.

Actually in the demo provided by you, ‘Handsontable’ in ‘private hotInstance: Handsontable;’ is giving an error ‘Cannot use namespace ‘Handsontable’ as a type.’ Even i am facing the same problem. hotInstance is undefined. Please look into it and let me know.

Hey @bhavrao8

You’ve mentioned that you’re using Angular 7, can you also tell me that wrapper (Handsontable for Angular) and the Handsontable versions do you use? It has an impact on the instance reference and might be an issue that we’re looking for.

Hi,

Actually I’m using HotTableModule from ‘ng2-handsontable’. The versions are:
“ng2-handsontable”: “^2.1.0-rc.3”,
“handsontable”: “^7.0.0”,
@handsontable/angular”: “^5.1.0”

Is this of any help?

Also, do we need handson table license to be able to export it to csv?

which is (how I understand) https://www.npmjs.com/package/ng2-handsontable is not part of our product line. We do not have any control over this library as it is owned by a person outside the company.

1 Like

Ok. Got it. Thanks for the help.

You’re welcome @bhavrao8
Have a nice day