Hi! I was very happy for found it yor librarie but with a quick example, i've been receiving the same error message:
Error: Object for request is wrong. Please confirm formData again. at FetchApp.Fetch(Code:66:17) at fetch(Code:17:27)
The code I use is the one you provide in README, and I don't know what I am missing:
function main() {
var folder = DriveApp.getFolderById('')
var file = folder.getFilesByName('Salvoconducto Okima.pdf').next()
var id = file.getId();
var fileBlob = DriveApp.getFileById(id).getBlob();
var metadata = {
name: "OCR-PDF-" + (new Date()).getYear(),
mimeType: MimeType.GOOGLE_DOCS
};
var form = FetchApp.createFormData();
form.append("metadata", Utilities.newBlob(JSON.stringify(metadata), "application/json"));
form.append("file", fileBlob);
var url = "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart";
var params = {
method: "POST",
headers: { Authorization: "Bearer " + ScriptApp.getOAuthToken() },
body: form
// muteHttpExceptions: true
};
var res = FetchApp.fetch(url, params);
console.log(res);
// DriveApp.createFile(blob) // This comment line is used for automatically detecting scope for running this sample script.
}
I tried with the code of closed issue but still give me the same error :(
I hope you can help me!
(Sorry for my english)