Hi, you are just phenomenal, thank you very much, the camera works quite well, just not uploading the information to the spreadsheet, the ID of the spreadsheet has 44 characters right? and in the app I get this error:
It is a Samsung A21s
I used the code like this and gave it Drive API permissions.
function doPost(e) {
var ss = SpreadsheetApp.openById('1c-l5A-aSeBcsQsDz4YUc6K8XitkTfYyCLmxE4phvGq0');
var sh = ss.getSheetByName('Sheet1');
var data = Utilities.base64Decode(e.parameters.data);
var blob = Utilities.newBlob(data, e.parameters.mimetype, e.parameters.filename);
var fileId = DriveApp.getFolderById(e.parameters.folderId).createFile(blob).getId();
var rowData = [];
rowData.push(e.parameters.itemName[0]);
rowData.push(e.parameters.itemDescription[0]);
rowData.push(e.parameters.itemValue[0]);
rowData.push(e.parameters.filename[0]);
rowData.push(fileId);
rowData.push('https://drive.google.com/file/d/' + fileId);
sh.appendRow(rowData);
return ContentService.createTextOutput('Image: ' + e.parameters.filename + ' with ID: ' + fileId + ' successfully uploaded to Google Drive' );
}```
Friend, it's working very well, thank you very much. I wanted to ask you how can I create new blocks? so I can call getASD and makeFilename, or how does it work? the same for 'to getASD' and to 'makeFilename'
It has something to do with?: HOWTO: Get Application Specific Directory -ASD (where one exists)
Thank you very much.
You need a File component, then drag out the procedure block and build the procedure. The action block for your procedure will be created in the procedure palette.
function doPost(e) {
var ss = SpreadsheetApp.openById('1jwAmuKhZOyYGTxsixkXj4QWjd4XS0maek7PnDo6cDWc');
var sh = ss.getSheetByName('Sheet2');
var data = Utilities.base64Decode(e.parameters.data);
var blob = Utilities.newBlob(data, e.parameters.mimetype, e.parameters.filename);
var fileId = DriveApp.getFolderById(e.parameters.folderId).createFile(blob).getId();
var rowData = [];
rowData.push(e.parameters.itemName[0]);
rowData.push(e.parameters.itemDescription[0]);
rowData.push(e.parameters.itemValue[0]);
rowData.push(e.parameters.filename[0]);
rowData.push(fileId);
rowData.push('https://drive.google.com/file/d/' + fileId);
sh.appendRow(rowData);
return ContentService.createTextOutput('Image: ' + e.parameters.filename + ' with ID: ' + fileId + ' successfully uploaded to Google Drive' );
}
Have just run a test with companion app, not having any problems returning base64 to an image in the canvas, with front or rear camera. Check your value in global current photo.
After taking photo you are converting it into base64. So use one label and in that lable you print the value of global photo variable so as to know what is happening. Test in companion and in apk