【发布时间】:2022-01-26 05:46:16
【问题描述】:
我m very new working with google script and APIs and Im 试图运行一段代码,将表格放入 Json,但是我遇到了一个问题,它说:
TypeError: Cannot read property 'getDataRange' of null
json @ Code.gs:4
我使用的代码如下:
function json() {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
const sheet = spreadsheet.getSheetByName("APItest")
const data = sheet.getDataRange().getValues()
const jsonData = convertToJson(data)
return ContentService
.createTextOutput(JSON.stringify(jsonData))
.setMimeType(ContentService.MimeType.JSON)
}
我已经尝试更改 getSheetID,但也没有成功
【问题讨论】:
标签: api google-apps-script google-sheets