Android (Java/Kotlin) Google Sheets API: Create New Spreadsheet

April 6, 2019
var spreadsheet = Spreadsheet()
    .setProperties(
        SpreadsheetProperties()
            .setTitle("CreateNewSpreadsheet")
    )

// need to run in background thread
spreadsheet = service.spreadsheets().create(spreadsheet).execute()
Timber.d("ID: ${spreadsheet.spreadsheetId}")

NOTE: service is Sheets. Refer to Setup Google Sheets API for Android (Java/Kotlin) to get service/Sheets instance.

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.