AI-generated Key Takeaways
-
CsvUpload
facilitates incremental building and uploading of data in CSV format to Google Ads. -
It provides methods for appending rows, specifying upload type (Campaign Management or Offline Conversions), applying changes, and previewing them.
-
append()
adds data rows to the CSV upload, matching keys with column headers. -
apply()
andpreview()
initiate the upload for either enacting changes or previewing them, respectively. -
You can specify the upload to be for Campaign Management (default) or Offline Conversions using respective methods.
Methods:
Member | Type | Description |
---|---|---|
append(row) | 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(fileName) | 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:
Name | Type | Description |
---|---|---|
row | Object |
The row object to append. |
Return values:
Type | Description |
---|---|
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:
Type | Description |
---|---|
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:
Type | Description |
---|---|
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:
Name | Type | Description |
---|---|---|
fileName | String |
The file name of the uploaded file. |
Return values:
Type | Description |
---|---|
AdsApp.CsvUpload |
The same upload with the file name applied. |