Extract PayPal transaction data directly from your browser with a single click! This bookmarklet parses PayPal's transaction history page and exports the data as JSON.
- Copy the bookmarklet code below
- Create a new bookmark in your browser
- Paste the code as the URL
- Click the bookmark when on PayPal's transaction page
- β Extract transaction ID, date, recipient, amount, currency, and status
- β Handles both DKK and foreign currencies
- β Automatically downloads JSON file with smart date-range filename
- β Displays formatted data in console
- β Sorts transactions by date (newest first)
- β Includes direct links to transaction details
javascript:(function(){console.log('π Starting PayPal transaction extraction...');const transactionRows=document.querySelectorAll('tr[data-testid]');console.log(`π Found ${transactionRows.length} potential transactions`);const transactions=[];transactionRows.forEach(row=>{const testId=row.getAttribute('data-testid');if(!testId||testId.length<10)return;const dateCell=row.querySelector(`td[data-testid="${testId}-date"]`);const descriptionCell=row.querySelector(`td[data-testid="${testId}-description"]`);const nameCell=row.querySelector(`td[data-testid="${testId}-name"]`);const grossCell=row.querySelector(`td[data-testid="${testId}-gross"]`);const statusCell=row.querySelector(`td[data-testid="${testId}-status"]`);if(!dateCell||!descriptionCell||!nameCell||!grossCell)return;const date=dateCell.textContent.trim();const description=descriptionCell.textContent.trim();const status=statusCell?statusCell.textContent.trim():'N/A';const nameLink=nameCell.querySelector('a');const recipient=nameLink?nameLink.textContent.trim():nameCell.textContent.trim();const transactionLink=nameLink?nameLink.getAttribute('href'):null;const fullTransactionLink=transactionLink?`https://www.paypal.com${transactionLink}`:null;const amountDiv=grossCell.querySelector('div');const amountText=amountDiv?amountDiv.textContent.trim():grossCell.textContent.trim();let amount=null;let currency=null;let amountDKK=null;let originalAmount=null;let originalCurrency=null;const amountRegex=/([0-9.,]+)\s*([A-Z$β¬Β£Β₯βΉβ½]+)\s*([A-Z]{3})?/;const match=amountText.match(amountRegex);if(match){amount=parseFloat(match[1].replace(',','.'));currency=match[3]||(match[2]==='$'?'USD':match[2]==='β¬'?'EUR':match[2]==='Β£'?'GBP':match[2]);if(currency==='DKK'){amountDKK=amount;}else{originalAmount=amount;originalCurrency=currency;}}const convertDate=(dateStr)=>{const[datePart,timePart]=dateStr.split(', ');const[day,month,year]=datePart.split('/');const[hour,minute]=timePart.split('.');return new Date(year,month-1,day,hour,minute).toISOString();};const transaction={transactionId:testId,date:date,dateISO:convertDate(date),description:description,recipient:recipient,status:status,amount:amount,currency:currency,amountDKK:amountDKK,originalAmount:originalAmount,originalCurrency:originalCurrency,amountText:amountText,transactionLink:fullTransactionLink};transactions.push(transaction);});transactions.sort((a,b)=>new Date(b.dateISO)-new Date(a.dateISO));console.log(`β
Extracted ${transactions.length} transactions:`);console.log('π Transaction data:',transactions);window.paypalTransactions=transactions;console.table(transactions.map(t=>({Date:t.date,Recipient:t.recipient,Amount:t.amountText,Status:t.status,Description:t.description})));const jsonOutput=JSON.stringify(transactions,null,2);console.log('\nπ JSON Output (copy this):');console.log(jsonOutput);const getFileName=()=>{if(transactions.length===0)return`paypal-transactions-${new Date().toISOString().split('T')[0]}.json`;const dates=transactions.map(t=>new Date(t.dateISO));const minDate=new Date(Math.min(...dates));const maxDate=new Date(Math.max(...dates));const formatDate=d=>d.toISOString().split('T')[0];return`Paypal-from-${formatDate(minDate)}-to-${formatDate(maxDate)}.json`;};const blob=new Blob([jsonOutput],{type:'application/json'});const url=URL.createObjectURL(blob);const a=document.createElement('a');a.href=url;a.download=getFileName();document.body.appendChild(a);a.click();document.body.removeChild(a);URL.revokeObjectURL(url);console.log('πΎ JSON file downloaded automatically!');console.log('π― Data also available in: window.paypalTransactions');return transactions;})();
- Copy the entire bookmarklet code above
- Right-click on your bookmarks bar (show with Ctrl+Shift+B if hidden)
- Select "Add page" or "Add bookmark"
- Name:
PayPal Extractor
- URL: Paste the copied JavaScript code
- Save the bookmark
- Copy the entire bookmarklet code above
- Right-click on your bookmarks bar
- Select "New Bookmark"
- Name:
PayPal Extractor
- Location: Paste the copied JavaScript code
- Save
- Navigate to your PayPal transaction history page
- Click the bookmarklet in your bookmarks bar
- Open Developer Console (F12) to see the results
- The JSON file will be automatically downloaded
The downloaded JSON file will automatically be named based on the date range of your transactions:
- Format:
Paypal-from-YYYY-MM-DD-to-YYYY-MM-DD.json
- Example:
Paypal-from-2024-01-19-to-2024-02-24.json
- Fallback: If no transactions found, uses current date:
paypal-transactions-YYYY-MM-DD.json
This makes it easy to identify which time period the data covers!
[
{
"transactionId": "234792349M9284",
"date": "19/01/2021, 12.56",
"dateISO": "2021-01-19T12:56:00.000Z",
"description": "Payment to",
"recipient": "WWW",
"status": "Completed",
"amount": 1.00,
"currency": "USD",
"amountDKK": null,
"originalAmount": 1.00,
"originalCurrency": "USD",
"amountText": "1,00 $ USD",
"transactionLink": "https://www.paypal.com/unifiedtransactions/details/payment/234792349M9284"
}
]
- Data Source: Extracts from PayPal's HTML table structure
- Compatibility: Works with modern browsers (Chrome, Firefox, Safari, Edge)
- Security: Runs entirely in your browser, no data sent to external servers
- Format: Exports as JSON with ISO date formatting
- Sorting: Automatically sorts transactions by date (newest first)
Feel free to fork this gist and improve the bookmarklet! Some ideas for enhancements:
- Add support for more transaction types
- Include fee information
- Add currency conversion
- Export to CSV format
This bookmarklet is provided as-is for personal use. Use at your own risk.