http://code.google.com/intl/ru/googleapps/appsscript/service_ui.html
function doGet(e) {
var app = UiApp.createApplication().setTitle("Upload CSV to Sheet");
var form = app.createFormPanel().setId('frm').setEncoding('multipart/form-data');
var formContent = app.createVerticalPanel();
form.add(formContent);
formContent.add(app.createFileUpload().setName('thefile'));
formContent.add(app.createSubmitButton('Submit'));
app.add(form);
return app;
}
function doPost(e) {
// data returned which can be used to create a blob
var assignmentFile = e.parameter.file;
// create a blob which mime type of the document.
// assuming mime-type to be text in this example
var uploadBlob = Utilities.newBlob(assignmentFile, "text/plain", "Filename.txt" );
Logger.log("Size:"+uploadBlob.getBytes().length);
// only applicable for Google Apps accounts
var doc = DocsList.createFile(uploadBlob);
app.close();
return app;
}
Комментариев нет:
Отправить комментарий