AdsApp.​BulkUploads

  • You can access bulk upload functionalities through FileUpload and CsvUpload .

  • The newCsvUpload method creates a CSV upload object with specified column headers and optional arguments for locale, money format, and time zone.

  • The newFileUpload method creates a file upload object that can use content from a Google Sheet, a File in Drive in supported formats, or a Blob with supported MIME types, also accepting optional arguments.

Access to bulk uploads: FileUpload , CsvUpload .

Methods:

Member Type Description
AdsApp.CsvUpload Creates a CsvUpload with the given column headers.
AdsApp.FileUpload Creates a FileUpload with the given Google Sheet.
AdsApp.FileUpload Creates a FileUpload with the content in the given File in Drive.
AdsApp.FileUpload Creates a FileUpload with the content in the given Blob.

newCsvUpload(columnNames, optArgs)

Creates a CsvUpload with the given column headers.

This method accepts an optional arguments object. The following optional arguments are supported:

Name
Type
Description
fileLocale
String
File locale, specified in ISO format. Affects how numbers and dates are parsed. Defaults to en_US . See a full list in Supported Locales .
moneyInMicros
boolean
Whether or not to represent money in micros ('1370000') or in currency ('1.37'). Defaults to true .
timeZone
String
The time zone to use for dates. No default. The following formats are supported:
  • A timezone in tz database (e.g. America/Los_Angeles etc.). See a full list in List of tz database time zones ;
  • Standard offsets in the form [+-]hhmm (e.g. +0800, -0500).
NOTE : this field is required for offline conversion uploads.

Example usages:

 // 
  
 Creates 
  
 a 
  
 CsvUpload 
  
 with 
  
 3 
  
 columns 
  
 named 
  
 'columnA' 
 , 
  
 'columnB' 
  
 and 
 // 
  
 'columnC' 
 , 
  
 respectively 
 . 
 var 
  
 upload1 
  
 = 
  
 AdsApp 
 . 
 bulkUploads 
 () 
 . 
 newCsvUpload 
 ( 
  
 [ 
 'columnA' 
 , 
  
 'columnB' 
 , 
  
 'columnC' 
 ]); 
 // 
  
 Creates 
  
 a 
  
 CsvUpload 
  
 which 
  
 represents 
  
 money 
  
 in 
  
 currency 
  
 ( 
 e 
 . 
 g 
 . 
  
 1.37 
 ) 
 // 
  
 instead 
  
 of 
  
 in 
  
 micros 
  
 ( 
 e 
 . 
 g 
 . 
  
 137000 
 ) 
 . 
 var 
  
 upload2 
  
 = 
  
 AdsApp 
 . 
 bulkUploads 
 () 
 . 
 newCsvUpload 
 ( 
  
 [ 
 'columnA' 
 , 
  
 'columnB' 
 , 
  
 'columnC' 
 ], 
  
 { 
  
 moneyInMicros 
 : 
  
 false 
  
 }); 

Arguments:

Name Type Description
columnNames
String[] The names of column headers.
optArgs
Object Optional arguments.

Return values:

Type Description
AdsApp.CsvUpload A CSV Bulk Upload with the given column headers, ready to have data appended.

newFileUpload(sheet, optArgs)

Creates a FileUpload with the given Google Sheet.

This method accepts an optional arguments object. The following optional arguments are supported:

Name
Type
Description
fileLocale
String
File locale, specified in ISO format. Affects how numbers and dates are parsed. Defaults to en_US . See a full list in Supported Locales .
moneyInMicros
boolean
Whether or not to represent money in micros ('1370000') or in currency ('1.37'). Defaults to true .
timeZone
String
The time zone to use for dates. No default. The following formats are supported:
  • A timezone in tz database (e.g. America/Los_Angeles etc.). See a full list in List of tz database time zones ;
  • Standard offsets in the form [+-]hhmm (e.g. +0800, -0500).
NOTE : this field is required for offline conversion uploads.

Arguments:

Name Type Description
sheet
SpreadsheetApp.Sheet The Sheet in Google Spreadsheet to be uploaded.
optArgs
Object Optional arguments.

Return values:

Type Description
AdsApp.FileUpload A Bulk Upload with the content in the given Google Sheet.

newFileUpload(file, optArgs)

Creates a FileUpload with the content in the given File in Drive.

This method only accepts files in supported formats (.csv, .tsv, .xls, .xlsx).

This method accepts an optional arguments object. The following optional arguments are supported:

Name
Type
Description
fileLocale
String
File locale, specified in ISO format. Affects how numbers and dates are parsed. Defaults to en_US . See a full list in Supported Locales .
moneyInMicros
boolean
Whether or not to represent money in micros ('1370000') or in currency ('1.37'). Defaults to true .
timeZone
String
The time zone to use for dates. No default. The following formats are supported:
  • A timezone in tz database (e.g. America/Los_Angeles etc.). See a full list in List of tz database time zones ;
  • Standard offsets in the form [+-]hhmm (e.g. +0800, -0500).
NOTE : this field is required for offline conversion uploads.

Example usages:

 // 
  
 Creates 
  
 a 
  
 Bulk 
  
 upload 
  
 from 
  
 an 
  
 . 
 xls 
  
 file 
  
 under 
  
 the 
  
 given 
  
 Drive 
  
 folder 
 . 
 var 
  
 files 
  
 = 
  
 DriveApp 
 . 
 getFolderById 
 ( 
 "folder_id" 
 ) 
  
 . 
 getFilesByType 
 ( 
 MimeType 
 . 
 MICROSOFT_EXCEL 
 ); 
 if 
  
 ( 
 files 
 . 
 hasNext 
 ()) 
  
 { 
  
 var 
  
 file 
  
 = 
  
 files 
 . 
 next 
 (); 
  
 var 
  
 upload 
  
 = 
  
 AdsApp 
 . 
 bulkUploads 
 () 
 . 
 newFileUpload 
 ( 
 file 
 ); 
 } 

Arguments:

Name Type Description
file
DriveApp.File The File in Drive to be uploaded.
optArgs
Object Optional arguments.

Return values:

Type Description
AdsApp.FileUpload A Bulk Upload with the content in the given File in Drive.

newFileUpload(blob, optArgs)

Creates a FileUpload with the content in the given Blob.

This method only accepts Blobs with supported MIME types ( CSV , MICROSOFT_EXCEL , MICROSOFT_EXCEL_LEGACY ).

This method accepts an optional arguments object. The following optional arguments are supported:

Name
Type
Description
fileLocale
String
File locale, specified in ISO format. Affects how numbers and dates are parsed. Defaults to en_US . See a full list in Supported Locales .
moneyInMicros
boolean
Whether or not to represent money in micros ('1370000') or in currency ('1.37'). Defaults to true .
timeZone
String
The time zone to use for dates. No default. The following formats are supported:
  • A timezone in tz database (e.g. America/Los_Angeles etc.). See a full list in List of tz database time zones ;
  • Standard offsets in the form [+-]hhmm (e.g. +0800, -0500).
NOTE : this field is required for offline conversion uploads.

Example usages:

 // 
  
 Creates 
  
 a 
  
 bulk 
  
 upload 
  
 with 
  
 the 
  
 content 
  
 fetched 
  
 from 
  
 url 
 . 
 var 
  
 url 
  
 = 
  
 "www.example.com/content.csv" 
 ; 
 var 
  
 blob 
  
 = 
  
 UrlFetchApp 
 . 
 fetch 
 ( 
 url 
 ) 
 . 
 getAs 
 ( 
 MimeType 
 . 
 CSV 
 ); 
 var 
  
 upload 
  
 = 
  
 AdsApp 
 . 
 bulkUploads 
 () 
 . 
 newFileUpload 
 ( 
 blob 
 ); 

Arguments:

Name Type Description
blob
Blob.Blob The Blob in Drive to be uploaded.
optArgs
Object Optional arguments.

Return values:

Type Description
AdsApp.FileUpload A Bulk Upload with the content in the given Blob in Drive.
Create a Mobile Website
View Site in Mobile | Classic
Share by: