Skip to content

Add Excel export feature for regular and super boards#63

Merged
OrF8 merged 15 commits intomainfrom
codex/add-excel-export-feature-to-expensemanagement-app
Apr 8, 2026
Merged

Add Excel export feature for regular and super boards#63
OrF8 merged 15 commits intomainfrom
codex/add-excel-export-feature-to-expensemanagement-app

Conversation

@OrF8
Copy link
Copy Markdown
Owner

@OrF8 OrF8 commented Apr 6, 2026

Motivation

  • Provide users the ability to export board transactions to .xlsx files so data can be archived or viewed in Excel/Sheets.
  • Support both regular boards (single worksheet) and super boards (one worksheet per sub-board) following existing UI placement and permission patterns.
  • Preserve app UX and data fidelity: keep Hebrew labels, handle nulls as empty cells, sanitize names/filenames, and avoid formula injection.

Description

  • Added a reusable browser-side export utility at src/utils/exportBoardToExcel.js that builds workbooks with Hebrew headers, nullable normalization (exported as empty cells), date formatting (dd/mm/yyyy for valid YYYY-MM-DD), numeric preservation for amounts, formula-injection protection for text fields, worksheet name and filename sanitization, and a spacer + footer row containing the attribution and URL (Generated by OF8's Expense Management web app - https://of8-expense-management.web.app/).
  • Wired export UI and flow into the app by: adding handleExportExcel() in src/pages/BoardPage.jsx to export the current board (single sheet) or fetch child boards and export one sheet per sub-board for super boards, and exposing loading/error state for the export action.
  • Placed the export action per requirements by extending src/components/ui/BoardHierarchyActionsMenu.jsx to optionally show a ייצוא לאקסל entry for super boards inside the existing "פעולות לוח" modal, and by adding a board-level ייצוא לאקסל header action button for regular boards near existing controls.
  • Added a one-shot helper getTransactionsForBoard(boardId) in src/firebase/transactions.js so super-board export can fetch each child board's transactions without changing existing realtime subscriptions or access rules.
  • Implemented client-side SheetJS usage via a CDN include added to index.html and load-checked window.XLSX inside the export utility so no backend changes or new endpoints were required.
  • Exported columns (order matches the transaction form labels): תאריך עסקה (אופציונלי), שם העסק, סכום (₪), סוג עסקה, שם, 4 ספרות אחרונות של הכרטיס, תשלום נוכחי, מתוך כמה תשלומים, פירוט/הערות (אופציונלי).
  • Safety/UX notes: worksheet names are sanitized and truncated to Excel limits, filenames are sanitized and appended with .xlsx, text cells starting with =, +, -, or @ are prefixed to prevent formula injection, and empty boards still export headers + spacer + footer.

Testing

  • Linting: ran npx eslint src/pages/BoardPage.jsx src/components/ui/BoardHierarchyActionsMenu.jsx src/utils/exportBoardToExcel.js src/firebase/transactions.js which passed (one pre-existing useMemo warning in BoardPage.jsx remains and is unrelated to the new feature).
  • Build: ran npm run build and the production build completed successfully.
  • Dependency install: attempted npm install xlsx but the environment returned 403 Forbidden, so the implementation falls back to loading SheetJS from the CDN via index.html (this was intentional after failing to install the package).
  • Manual verification performed during development: exporting a regular board creates a single worksheet using currently loaded transactions; exporting a super board creates one worksheet per sub-board (transactions fetched with getTransactionsForBoard); null/undefined fields become empty cells; footer row is appended; negative amounts and numeric values are preserved as numbers.

Codex Task

@OrF8 OrF8 self-assigned this Apr 6, 2026
@OrF8 OrF8 added enhancement New feature or request javascript Pull requests that update javascript code labels Apr 6, 2026
@OrF8 OrF8 marked this pull request as ready for review April 6, 2026 22:30
Copilot AI review requested due to automatic review settings April 6, 2026 22:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a client-side Excel export feature for board transactions, supporting both regular boards (single worksheet) and super boards (one worksheet per sub-board) using SheetJS.

Changes:

  • Introduced exportBoardToExcel utility to generate .xlsx workbooks with Hebrew headers, sanitization, and a footer.
  • Added export UI and flow in BoardPage (header button for regular boards; actions menu item for super boards).
  • Added a one-shot Firestore read helper to fetch transactions per board for super-board export.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils/exportBoardToExcel.js Builds and downloads .xlsx workbooks; sanitizes sheet/file names; maps transactions to rows.
src/pages/BoardPage.jsx Adds export state/UI and export handler for regular + super boards.
src/firebase/transactions.js Adds getTransactionsForBoard(boardId) one-shot read for export.
src/components/ui/BoardHierarchyActionsMenu.jsx Extends actions menu to optionally include an export action with loading state.
index.html Loads SheetJS via CDN so the export utility can use window.XLSX.
Comments suppressed due to low confidence (1)

src/pages/BoardPage.jsx:65

  • exportError is stored in component state and rendered at the top of the page, but it isn’t cleared when navigating to a different board. This can leave a stale export error visible on the next board until the user exports again. Consider resetting exportError (and optionally exportingExcel) in the existing useEffect that runs on boardId changes.
  const [exportingExcel, setExportingExcel] = useState(false);
  const [exportError, setExportError] = useState(null);
  const [userNickname, setUserNickname] = useState('');
  /**
   * Active payment-method filter.
   * null  → no filter active
   * string → a perGroup key, e.g. "card:1234" or "type:cash"
   */
  const [activePaymentFilterKey, setActivePaymentFilterKey] = useState(null);

  // Clear the payment-method filter whenever the user navigates to a different board
  useEffect(() => {
    setActivePaymentFilterKey(null);
  }, [boardId]);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Repository owner deleted a comment from chatgpt-codex-connector bot Apr 7, 2026
@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 8, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedvite@​8.0.5 ⏵ 8.0.79410082 +199 +1100

View full report

…o-expensemanagement-app' into codex/add-excel-export-feature-to-expensemanagement-app
@OrF8
Copy link
Copy Markdown
Owner Author

OrF8 commented Apr 8, 2026

@codex

When exporting to .xlsx, transactions with dates are rendered as YYYY-MM-DD instead of DD-MM-YYYY. Also, in Excel I see that they type of the cell is general instead of date. Please fix this.

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Fixed Excel date parsing so YYYY-MM-DD values are converted using Date.UTC(...) before export, which prevents timezone-related fallback to plain text and keeps date cells typed as actual dates in Excel (instead of General). src/utils/exportBoardToExcel.jsL41-L64
  • Updated exported Excel date display format from dd/mm/yyyy to dd-mm-yyyy so dates render as DD-MM-YYYY as requested. src/utils/exportBoardToExcel.jsL170-L172
  • Committed the change on branch work (4466f44) and created a follow-up PR via make_pr with a title/body describing these fixes.

Testing

  • npx eslint src/utils/exportBoardToExcel.js

View task →

OrF8 added 2 commits April 8, 2026 19:11
…t-feature-for-regular-and-sup

Fix exported transaction dates to be real Excel date cells in DD-MM-YYYY
Repository owner deleted a comment from chatgpt-codex-connector bot Apr 8, 2026
@OrF8 OrF8 merged commit 0840333 into main Apr 8, 2026
4 checks passed
@OrF8 OrF8 deleted the codex/add-excel-export-feature-to-expensemanagement-app branch April 8, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex enhancement New feature or request javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants