Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transformHeader for unparse? #1036

Open
MihailsKuzmins opened this issue Jan 24, 2024 · 0 comments
Open

transformHeader for unparse? #1036

MihailsKuzmins opened this issue Jan 24, 2024 · 0 comments

Comments

@MihailsKuzmins
Copy link

MihailsKuzmins commented Jan 24, 2024

According to the documentation (https://www.papaparse.com/docs#unparse-config-default) unparse does not provide "transformHeader" functionality, so it is not possible to customize the headers while preserving the original object. Are there any plans to add this functionality in the future?

For now the only solution is to add these original properties to the original object and specify them as "columns" of UnparseConfig.

const csvOptions: UnparseConfig = {
  columns: ['customHeader'],
  // ... more properties
};

for (const item of items) {
  item['customHeader'] = item['realProperty'];
}

const csvData = Papa.unparse(items, csvOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant