Closed
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2ExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributor
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.3.52-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #81548
Email or phone of affected tester (no customers): testpayment935@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 pro /Chrome
App Component: Workspace Settings
Action Performed:
- Navigate to staging.new.expensify.com
- Log in as a workspace admin on staging.
- Navigate to Workspace Settings → Categories.
- Export the categories CSV.
- Modify the CSV by:
- Adding at least one new category
- Re-import the CSV via More → Import spreadsheet.
Expected Result:
The enabled category should remain enabled after importing new category
Actual Result:
The all category become disabled
The enabled category CSV changed the enabled input to a capital letter
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
bug.mp4
Issue Owner
Current Issue Owner: @mallenexpensifyUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022039844386983496376
- Upwork Job ID: 2039844386983496376
- Last Price Increase: 2026-04-09
Metadata
Metadata
Assignees
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2ExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributor
Type
Projects
- StatusShow more project fieldsDone
Activity
MelvinBot commentedon Apr 2, 2026
Proposal
What is the root cause of that problem?
The CSV import logic uses a case-sensitive comparison (
=== 'true') when parsing the "enabled" column. When the server-sideExportCategoriesCSVcommand generates the CSV, it writes the enabled value using non-lowercase casing (e.g.,TRUEorTrue). On re-import, the strict lowercase check atImportedCategoriesPage.tsx:108fails for every category, causing them all to be set toenabled: false.What changes do you think we should make in order to solve the problem?
Make the enabled comparison case-insensitive by applying
.toLowerCase()before comparing:In
ImportedCategoriesPage.tsx:108, change the enabled parsing from=== 'true'to?.toLowerCase() === 'true'.The same fix should be applied to
ImportedTagsPage.tsx:108, which has the identical case-sensitive comparison for tags.Investigation details
Data flow:
downloadCategoriesCSV()→ server generates CSV with enabled values in non-lowercase casingImportSpreadsheetcomponentImportSpreadsheet.tsxreads CSV withXLSX.read()usingraw: true, preserving original string casingString(cell)— no case normalization occursImportedCategoriesPage.tsx:108compares with strict=== 'true'— fails forTRUE/Trueenabled: falseWhy
raw: truematters: The XLSX library is configured withraw: trueatImportSpreadsheet.tsx:112, which preserves original string values from the CSV without any type coercion or normalization.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Apr 2, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (
External)[-]Categories - Re-imported categories become disabled after adding new category[/-][+][$250] Categories - Re-imported categories become disabled after adding new category[/+]melvin-bot commentedon Apr 2, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022039844386983496376
trasnake87 commentedon Apr 2, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user exports their workspace categories as CSV and re-imports it (with or without new categories added), all previously enabled categories become disabled because the boolean "enabled" values from the CSV are not normalized during data ingestion.
What is the root cause of that problem?
The root cause is in
src/libs/actions/ImportSpreadsheet.ts#L34. WhensetSpreadsheetDatatransposes and stores the CSV data, it converts every cell to a string viaString(row.at(colIndex) ?? '')without normalizing boolean-like values. The backend exports enabled values as"TRUE"or"True", and these are stored verbatim in the Onyx spreadsheet data. Downstream consumers then compare against the lowercase string'true'and the match fails, causing all categories to be marked as disabled.What changes do you think we should make in order to solve the problem?
We should normalize boolean-like string values to lowercase at the data ingestion point in
setSpreadsheetData. This fixes the issue for all import flows (categories and tags) in a single location.In
src/libs/actions/ImportSpreadsheet.ts, change line 34 from:to:
This normalizes any cell containing a case-variant of "true" or "false" to lowercase at the point where spreadsheet data is stored, so all downstream comparisons (
=== 'true') work correctly regardless of how the backend serialized the boolean values.trasnake87 commentedon Apr 2, 2026
Contributor details
Your Expensify account email: trasnake87@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~010f770315ab181656
melvin-bot commentedon Apr 2, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
wildan-m commentedon Apr 2, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace admin exports categories to CSV, modifies it (e.g. adds a new category), and re-imports the CSV, all previously enabled categories become disabled.
What is the root cause of that problem?
The CSV import logic in
ImportedCategoriesPageuses a strict case-sensitive comparison=== 'true'when parsing the enabled column from the imported spreadsheet:App/src/pages/workspace/categories/ImportedCategoriesPage.tsx
Line 108 in be18db3
The server-side
ExportCategoriesCSVcommand generates the CSV with the enabled value in non-lowercase casing (e.g.TRUEorTrue). TheImportSpreadsheetcomponent reads the CSV usingXLSX.read()withraw: true, which preserves the original string casing without normalization:App/src/components/ImportSpreadsheet.tsx
Line 112 in be18db3
Cell values then pass through
String(cell)which also does not normalize casing. So"TRUE" === 'true'evaluates tofalse, and every category gets sent to the server withenabled: false.The same bug exists in
ImportedTagsPageat the identical line:App/src/pages/workspace/tags/ImportedTagsPage.tsx
Line 108 in be18db3
What changes do you think we should make in order to solve the problem?
Make the enabled comparison case-insensitive by normalizing the value to lowercase before comparing. In both
ImportedCategoriesPage.tsx(line 108) andImportedTagsPage.tsx(line 108), change=== 'true'to?.toLowerCase() === 'true'.This handles all casing variants (
TRUE,True,true) from server-generated CSV exports. The optional chaining (?.) is needed because the value can be undefined if the spreadsheet row is shorter than expected.Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/87033-fix-csv-import-enabled-casing?expand=1
What alternative solutions did you explore? (Optional)
An alternative would be to normalize boolean-like cell values at the
ImportSpreadsheetcomponent level (in the cell processing step at lines 125-136) so all downstream import pages receive consistent lowercase strings. However, this is more invasive — it changes shared infrastructure used by all import flows (categories, tags, members) and could have unintended side effects on non-boolean columns. Fixing at the point of comparison is safer and more targeted.wildan-m commentedon Apr 2, 2026
Proposal
Updated
Added compare branch with implementation.
41 remaining items
melvin-bot commentedon May 10, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon May 11, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon May 12, 2026
Payment Summary
Contributor+: @sobitneupane due $250 via NewDot
@sobitneupane plz complete the BZ checklist and tag me in a post once you have. Thx
sobitneupane commentedon May 14, 2026
Regression Test Proposal
Test:
Do we agree 👍 or 👎
sobitneupane commentedon May 14, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: Add CSV import flow to Categories page #47827 (comment)
Link to the comment on the Issue: [Support CSV] Create import flow for categories #47357 (comment)
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/637607
Zapier Logs
Run ID: 00040eee-dc62-a608-3710-c294877592e4sobitneupane commentedon May 14, 2026
@mallenexpensify
melvin-bot commentedon May 15, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
JmillsExpensify commentedon May 24, 2026
$250 approved for @sobitneupane