This Apple Shortcut reads a CSV transaction file, extracts all rows containing the category CASH, keeps the original CSV header, and creates a new CSV file containing only CASH transactions.
The workflow is similar to a Python pandas filter:
df[df["category"] == "CASH"]but implemented entirely inside Apple Shortcuts.
Shortcut link: https://www.icloud.com/shortcuts/8364db4cc2a544d8a000b491940050d7
Select File
↓
Get Name of File
The shortcut starts by asking the user to select the original CSV file.
Example:
TR-June2026.csv
Get File Name
↓
Replace ".csv" with "_cash.csv"
↓
Set Variable: orig_filename
Example:
Input:
TR-June2026.csv
becomes:
TR-June2026_cash.csv
This variable is later used as the output filename.
Create an empty list and initialize it:
List
(empty)
↓
Add orig_filename
↓
Set Variable: cash_list
cash_list will temporarily store the rows that will become the new CSV.
Original File
↓
Split Text
↓
Split by New Lines
The CSV is converted into a list:
[
Header row,
Transaction row 1,
Transaction row 2,
Transaction row 3
]
Repeat with Each Item
↓
Repeat Item = current CSV row
Repeat Index = row number
The first row contains the column names.
Logic:
If Repeat Index = 1
↓
Add Repeat Item
to cash_list
Example:
date,category,amount,description
is always preserved.
For all other rows:
Otherwise
↓
If Repeat Item contains "CASH"
↓
Add Repeat Item
to cash_list
Example:
Kept:
2026-06-01,CASH,100,Deposit
Ignored:
2026-06-02,TRADING,250,Stock purchase
Select File
↓
Get Name of File
↓
Replace ".csv" with "_cash.csv"
↓
Set Variable orig_filename
↓
List
↓
Add orig_filename
↓
Set Variable cash_list
↓
Split File by New Lines
↓
Repeat with Each Item
↓
┌───────────────────────┐
│ Repeat Index = 1 ? │
└───────────────────────┘
↓ Yes
Add Header Row
to cash_list
↓ No
┌───────────────────────┐
│ Contains "CASH" ? │
└───────────────────────┘
↓ Yes
Add Row
to cash_list
↓
End Repeat
↓
Combine cash_list
with New Lines
↓
Save File
The shortcut generates:
TR-June2026_cash.csv
Containing:
date,category,amount,description
2026-06-01,CASH,100,Deposit
2026-06-05,CASH,50,Withdrawal
while excluding non-CASH transactions.
Repeat Index = 1is used instead of a manual counter because Shortcuts already provides the row position.- The header is preserved so the exported file remains a valid CSV.
- The workflow can be adapted easily for other categories by replacing
"CASH"with another value such as"TRADING".