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

Feat: Add export to CSV support #292

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yuvarajsai
Copy link
Contributor

@yuvarajsai yuvarajsai commented Jan 6, 2025

Feature Enhancement: Export Group Data to CSV

This pull request introduces a new feature that allows users to export group data as a CSV file. The feature enhances accessibility and usability by providing an easily shareable and analyzable data format.

Addressed Issue: Feature request: Export Data as a User-Friendly CSV File (similar to Splitwise) #282

Key Features

  • CSV Export Functionality: Users can export group expenses to a CSV file with a single click.
  • Comprehensive Data Structure: The exported CSV includes:
    • Date: When the expense occurred.
    • Description: Details of the expense.
    • Category: Expense category.
    • Currency: Currency used.
    • Cost: Total amount of the expense.
    • Is Reimbursement: Whether the expense is a reimbursement or not.
    • Split mode: The method used to split the expense (e.g., Evenly, By shares, By percentage, By amount).
    • Participants: Individuals involved in the expense.

Benefits

  • Improved Accessibility: Simplifies access to expense data for non-technical users without requiring JSON parsing.
  • Enhanced Data Analysis: Enables users to perform detailed analysis and reporting using spreadsheet tools like Excel or Google Sheets.
  • Seamless Sharing: Provides a universally accepted format for easy sharing with group members or other stakeholders.

Implementation Details

  • CSV Conversion: The conversion is handled using the @json2csv/plainjs package, ensuring a clean and accurate CSV output.
  • Participant Shares Converted to Amounts: For better readability, the participants’ shares are converted into their respective amounts in the CSV file.
  • UI Enhancements: To prevent overwhelming the user interface, the "Export to JSON" and "Export to CSV" options are now hidden under a dedicated "Export" button.
  • File Naming: The exported CSV file is named using the group name and the date of export, and it is saved with a .csv extension.
  • No Changes to Export to JSON: The "Export to JSON" flow remains unchanged and continues to function as expected.

Screenshots:

image

CSV file opened in Excel:
image

@yuvarajsai
Copy link
Contributor Author

@scastiel, can you please review this when you get a chance?

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

Successfully merging this pull request may close these issues.

1 participant