Uploading to Cloudinary from Google Sheets
If you want to do an unsigned image upload from Google Sheets to Cloudinary, here's the correct Apps Script snippet that does that:
function uploadImageToCloudinary() {
var formData = {
file: "<file_path>", // Replace with the file URL or base64 string
upload_preset: "<upload_preset>" // Replace with your upload preset
};
var options = {
method: "post",
payload: formData
};
var response = UrlFetchApp.fetch(
"https://api.cloudinary.com/v1_1/<cloud_name>/image/upload/",
options
);
Logger.log(response.getContentText()); // Logs the Cloudinary response
}
I have used this on the Multi-AI Script product that I have. Earlier, I was using the default unsigned upload script and it wasn't working properly as it should, but now it's seamless.
Webmentions