Automating PayPal Multi-currency Transactions

Automated Accounting using Python and JavaScript Part 2

PayPal into Quick Books Online

This is part two of Automating PayPal multicurrency transactions, in part one, we went over how to extract a CSV file from PayPal’s reporting section.

Pre-Requisite: Google Drive (https://www.google.com/drive/download/) – The drive is very cool, it allows you to essentially have a cloud version of a USB which is accessible by you anywhere in the world where you have an internet connection. Also, it allows you to have an additional hard drive connected directly to your computer, meaning you could download files directly to your drive if you wanted to.

Required Libraries:

import csv
import shutil
import os.path

This part will go over moving your file and renaming it to a consistent name, along with deleting the old file (if it exists)

After downloading the file in part one, it gets added to your download path. As a default, this location is your downloads folder.

As part of a good process, we should delete our previous day’s file as we back up our Google Spreadsheet, to be discussed in part three.  To determine if the old file exists, we must check the template files name.

exists = os.path.isfile(r'G:\My Drive\'YOURNAMEHERE'.CSV')
try:
if exists:
os.remove(r'
G:\My Drive\'YOURNAMEHERE'.CSV')
except Exception as e:
raise e

Now we need to reference our downloaded file; by default, PayPal’s report is named “Download.csv.”

FileName = r"C:\Users\Matt\Downloads\Download.CSV"

Finally, we use the function “shutil.move” to relocate the file to the location of the old file.

shutil.move(FileName, r'G:\My Drive\'YOURNAMEHERE'.CSV')

Below is the full script.

import csv
import shutil
import os.path

exists = os.path.isfile(r'G:\My Drive\'YOURNAMEHERE'.CSV')
try:
if exists:
os.remove(r'
G:\My Drive\'YOURNAMEHERE'.CSV')
except Exception as e:
raise e

FileName = r"C:\Users\Matt\Downloads\Download.CSV"

shutil.move(FileName, r'
G:\My Drive\'YOURNAMEHERE'.CSV')

Waller Accounting

Leave a Reply

Your email address will not be published. Required fields are marked *

Waller AccountingHeadquarters
Organically grow the holistic world view of disruptive innovation via empowerment.
Our service locationsAreas of Service?
http://www.walleraccounting.com/wp-content/uploads/2019/04/img-footer-map.png
Surrey
Langley
Abbotsford
Get in touchWaller Accounting Social links
Taking seamless key performance indicators offline to maximise the long tail.
Waller AccountingHeadquarters
Organically grow the holistic world view of disruptive innovation via empowerment.
Our locationsWhere to find us?
http://www.walleraccounting.com/wp-content/uploads/2019/04/img-footer-map.png
Surrey
Langley
Abbotsford
Get in touchWaller Accounting Social links
Taking seamless key performance indicators offline to maximise the long tail.