I have an HTML sidebar in a Google spreadsheet with a file upload input field that doesn't work with the new v8 engine. It does work in the old runtimeVersion DEPRECATED_ES5.
The file upload in the sidebar is for uploading a single file to my google drive.
Html file
<body>
<h1>File Uploader</h1>
<form>
<input type="file" name="myFile" id="file">
<br>
<input class="blue" type="button" id="submitBtn" value="Upload File" onclick="uploadthis(this.parentNode)">
</form>
<input type="button" value="Close" onclick="google.script.host.close()" />
<script>
function uploadthis(fileForm){
google.script.run
.uploadFiles(fileForm)
}
</script>
</body>
And here the simplified gs
function uploadContract() {
var html = HtmlService.createHtmlOutputFromFile('ContractUpload').setTitle('Kontrakt upload').setWidth(300);
SpreadsheetApp.getUi().showSidebar(html);
}
function uploadFiles(data){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sStamdata = ss.getSheetByName('Stamdata_New');
var contractFolderId = sStamdata.getRange('D60').getValue();
var idag = Utilities.formatDate(new Date(), "GMT+1", "yyyyMMdd");
var title = sStamdata.getRange('D52').getValue();
var file = data.myFile;
var folder = DriveApp.getFolderById(contractFolderId);
var createFile = folder.createFile(file);
createFile.setName(idag+" - KONTRAKT - "+title);
}