-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Export to CSV #371
Export to CSV #371
Conversation
@pandeymangg is attempting to deploy a commit to the formbricks Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pandeymangg Thanks a lot for your work and the PR 💪😊
I am having trouble getting my browser (Chrome as well as Firefox) to download the CSV file due to this browser error after clicking the "Export to CSV" button:
You are not allowed to load local resource: blob:nodedata:aaa52f51-f541-485f-897b-26824ae55e70
Johannes gets the same error. Can you reproduce this?
According to chatGPT, this is due to a security restriction in modern browsers to prevent downloading from the local file system, and it suggests creating a blob of type csv first and then downloading it.
Once this is fixed I can check the PR and CSV results properly 💪.
@mattinannt I'm not able to reproduce the same error in my browsers, neither chrome nor firefox. And I have actually created the blob of type csv first before making the URL object, I'm not sure what the exact problem is, I'll try to debug this and update the PR |
@mattinannt The CSV download is fixed and working well. No more remarks from my end, please merge when you agree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pandeymangg thanks a lot for the changes 😊 The CSV now works great on my end, too 💪
The code also looks great :-)
I would like you to make some minor improvements to the exported CSV before merging the changes.
can you please use a dynamic file-name for the survey. e.g. the export of the survey named My Survey
should be my_survey_responses_2023_06_15.csv
In this filename:
my_survey
is a URL-friendly version of "My Survey". Spaces are replaced with underscores or hyphens, and all letters are lowercased.
responses
specifies what kind of data is in the file.
2023_06_15
is the date when the file was created. This can be especially useful if there are multiple exports over time.
You currently have a Date Submitted
submitted column in the CSV but for a more detailed data analysis it would be helpful to have the date-time. Can you please change the name of the column to Timestamp
and the Date to an ISO-String?
@mattinannt Got it, I'll make these changes and update the PR. Apart from these changes, I was also considering of changing the package that I'm using to convert json to csv. I'm currently using the Reference: https://juanjodiaz.github.io/json2csv/#/parsers/node-async-parser |
Thanks for pointing this out. I think switching to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pandeymangg Awesome, works great 💪 Thanks for this contribution; I'm going to merge the feature now 😊
* add CSV export feature to responses page
* add CSV export feature to responses page
* add CSV export feature to responses page
What does this PR do?
Fixes #253
Type of change
How should this be tested?
Checklist
pnpm build
console.logs
git pull origin main