I’m having trouble generating a new Google Sheet with Swift 4 utilizing the Sheets API. I want to ensure that I can reference this newly created sheet later in my application, which means I need it to return the spreadsheet ID. Here’s the current code I am working with:
func generateSpreadsheet() {
let requestURL = NSURL(string: "https://sheets.googleapis.com/v4/spreadsheets")
let dataTask = URLSession.shared.dataTask(with: requestURL! as URL) {
(receivedData, receivedResponse, requestError) in
print(NSString(data: receivedData!, encoding: String.Encoding.utf8.rawValue)!)
}
dataTask.resume()
print(dataTask)
}