function uploadFeedData() {
const accountId = AdsUtilities.getCurrentAccountId();
const uploadType = 'UPDATE_ALL';//UPDATE_ALL or UPDATE_PART
const fileId = 'fileIdAAA';//The file ID of the file on Google Drive
//Obtain the feed ID (as it cannot be checked on the management screen)
let feedMaster = Display.FeedService.get({
accountId: accountId
}).rval;
if (feedMaster.totalNumEntries == 0) {
throw new Error('No feed ID exists in the account.');
}
const feedId = feedMaster.values[0].feed.feedId;
//File Upload
var fileContent = DriveApp.getFileById(fileId).getBlob().getBytes();
let uploadFeedData = Display.FeedDataService.upload(
accountId,
feedId,
uploadType,
false,
fileContent
).rval;
if (uploadFeedData.values[0].operationSucceeded) {
let feedData = uploadFeedData.values[0].feedData;
Logger.log('feedId -> ' + feedData.feedId
+ ', fileUploadStatus -> ' + feedData.fileUploadStatus
+ ', itemListUploadId -> ' + feedData.itemListUploadId + ' have been uploaded.');
} else {
Logger.log('feedId-> ' + feedId + ' could not to be uploaded.');
}
}