How I can get a CVS from an URL and import as ad?

52 views
Skip to first unread message

desenvo...@ciapixel.com.br

unread,
Jun 29, 2018, 8:53:44 AM6/29/18
to AdWords Scripts Forum
I need to create a script to import data from a CVS and then create ads with this records, but I have no idea how make this?

I saw some scripts in the documentation, but I need orientation from make this. Somebody can help me?

Anthony Madrigal

unread,
Jun 29, 2018, 4:08:32 PM6/29/18
to AdWords Scripts Forum
Hello,

You can use the bulk upload feature to use a CSV file to create ads via AdWords Scripts. You can find different methods on how to use this function here.

Here are the supported fields you will need to upload ads via bulk upload. 

Cheers,
Anthony
AdWords Scripts Team

desenvo...@ciapixel.com.br

unread,
Jul 2, 2018, 1:57:11 PM7/2/18
to AdWords Scripts Forum
I created this script to try get the data:
function main() {
  
   function bulkUploadFromRemoteServer() {
  // for the list of supported bulk upload templates.
    var dataUrl = 'My URL';

    var blob = UrlFetchApp.fetch(dataUrl)
        .getBlob()
        .getAs(MimeType.CSV);

    var upload = AdWordsApp.bulkUploads().newFileUpload(blob);
    upload.forCampaignManagement();

    // Use upload.apply() to make changes without previewing.
    upload.preview();
  }
  bulkUploadFromRemoteServer();
  
  
}

But I get this error, when I execute my script:
Converting from application/octet-stream to text/csv is not supported. (line 8)

I attached my example file to you see, Where I do make mistake?
temquepegar.csv

Anthony Madrigal

unread,
Jul 2, 2018, 3:43:25 PM7/2/18
to AdWords Scripts Forum
Hi, 

Can you please reply privately to author your CID and script name so I can investigate further?

Thanks,
Anthony
AdWords Scripts Team
Reply all
Reply to author
Forward
0 new messages