AdsApp.​CsvUpload

Represents a Bulk Upload which can be incrementally built up in CSV format and uploaded to the Bulk Uploads service.

Methods:

MemberTypeDescription
append AdsApp.CsvUpload Appends a row to the Bulk Upload.
apply void Uploads the file and applies the changes.
forCampaignManagement AdsApp.CsvUpload Specifies that this upload is used for Campaign Management entity changes.
forOfflineConversions AdsApp.CsvUpload Specifies that this upload is used for reporting offline conversions.
preview void Uploads the file and previews the changes.
setFileName AdsApp.CsvUpload Sets the file name of the uploaded file.

append(row)

Appends a row to the Bulk Upload.

The row object is a key-value map. For each key-value pair:

  • If the key exists in the provided column headers, its value will fill into the cell corresponding to the matching column;
  • If it doesn't exist, the key-value pair is ignored.
// The resulting CSV bulk upload of the following code would be:
// +-------------+-------------+----------------+
// |   Campaign  | Campaign ID | Campaign state |
// +-------------+-------------+----------------+
// | Campaign #2 |  2001684997 |     enabled    |
// +-------------+-------------+----------------+
var bulkUpload = AdsApp.bulkUploads().newCsvUpload([
    "Campaign",
    "Campaign ID",
    "Campaign state"]);
bulkUpload.append({
    "Campaign":"Campaign #2",
    "Campaign ID":"2001684997",
    "Campaign state":"enabled"});

Arguments:

NameTypeDescription
row Object The row object to append.

Return values:

TypeDescription
AdsApp.CsvUpload The Bulk Upload with the additional row.

apply()

Uploads the file and applies the changes.

Returns nothing.

forCampaignManagement()

Specifies that this upload is used for Campaign Management entity changes.

This is the default option, so this method doesn't need to be called except to override a previous call to CsvUpload.forOfflineConversions().

Return values:

TypeDescription
AdsApp.CsvUpload The same upload specified to change Campaign Management entities.

forOfflineConversions()

Specifies that this upload is used for reporting offline conversions.

By default, uploads are used for Campaign Management entity changes, so it's necessary to call CsvUpload.forOfflineConversions() to make offline conversion uploads work correctly.

Return values:

TypeDescription
AdsApp.CsvUpload The same upload specified to report offline conversions.

preview()

Uploads the file and previews the changes.

Returns nothing.

setFileName(fileName)

Sets the file name of the uploaded file.

Arguments:

NameTypeDescription
fileName String The file name of the uploaded file.

Return values:

TypeDescription
AdsApp.CsvUpload The same upload with the file name applied.