Hello All,
I'm trying to write a script to directly upload data from a .csv file
stored on a local hard drive to a google spreadsheet without placing the
.csv into the google docs list.
I realize that google spreadsheets already has a function for doing this,
but my end game here is to be able to upload data daily from a .csv on a
local drive, to my script, sort through it, and return only the necessary
information to a spreadsheet.
Currently I'm trying to test my readDSR (should be reading the uploaded
.csv)function by returning the .csv data as a string in my spreadsheet.
However it won't work. I would really appreciate some help on this one. My
code is below
Thanks, -Jamie
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries =
[ {name:"Read Data", functionName:"readRows"},
{name:"Upload DSR", functionName:"findDSR()"} ];
sheet.addMenu("Du-par's", entries);
};
function findDSR() {
var openFile = UiApp.createApplication();
var formContent = openFile.createVerticalPanel();
formContent.add(openFile.createFileUpload().setName("DSRfile"));
formContent.add(openFile.createSubmitButton("Start Upload"));
var form = openFile.createFormPanel();
form.add(formContent);
openFile.add(form);
SpreadsheetApp.getActiveSpreadsheet().show(openFile);
}
function readDSR(e) {
DSR = e.parameter.DSRfile;
csvFile = DSR.getContentAsString();
var sheet = getActiveSheet();
var lastRow = sheet.getLastRow()+1;
var lastCell = sheet.getLastCell("A"+lastRow);
lastCell.setValue = csvFile;
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.