Are you using gmail ?
A quick howto:
Import a csv file from GMail
Preliminaries:
On your PC, login to your receiving google account
Open Gmail
Create a new google sheet
The scripting that follows was designed to run once a day,
and overwrite the existing data!
Part 1 - GMail Setup
In GMail, go to Settings, then Filters
Create a new filter
You want your filter to look for emails from a specific email address, with a specific subject, and that have an attachment:
Matches: from:(zzz@gmail.com) subject:(My CSV Data File) has:attachment
Then you want to set the actions:
Do this: Star it, Apply label "MYCSVFILE"
Part 2 - Google Sheet and Script
In your new google sheet, give the sheet a useful name
From Tools, open the Script Editor
A new script will open, give it a useful name
Add the following code:
function importCSVFromGmail() {
//gets first (latest) message with set label
var threads = GmailApp.getUserLabelByName('MYCSVFILE').getThreads(0,1);
var message = threads[0].getMessages()[0];
var attachment = message.getAttachments()[0];
// is the attachment a suitable CSV file
if (attachment.getContentType() === "text/csv") {
var ss = SpreadsheetApp.getActive();
var sh = ss.getSheetByName("Sheet1");
// remember to clear the content of the sheet before importing new data
sh.clearContents().clearFormats();
//parses content of csv to array
var csvData = Utilities.parseCsv(attachment.getDataAsString(), ",");
//pastes array to sheet
sh.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);
// mark message as read
message.markRead();
// nnstar the message
message.unstar();
confirmSuccess()
} else {
confirmFail();
}
}
//sends email to owner after all other script elements have completed //”assumes” success ;)
function confirmSuccess() {
MailApp.sendEmail("zzz@gmail.com", "CSV FILE IMPORT", "Script to create new listing completed successfully. This script runs every day between midnight and 1am");
}
//sends email to owner after all other script elements have completed //”assumes” fail;)
function confirmFail() {
MailApp.sendEmail("zzz@gmail.com", "CSV FILE IMPORT FAILED", "Script to create new listing failed to complete. Please contact the google admin. This script runs every day between midnight and 1am");
}
Set up a time driven trigger for the script
That should be it
You can then download the data to your app.
(Credits Amit Agarwal for original idea)