Google Apps 스크립트를 사용하여 Google 스프레드 시트를 JSON (또는 XML)으로 내보내려고합니다. 내 Google 시트는 다음과 같습니다.
https://docs.google.com/spreadsheets/d/15fwOeR6Jo4UadzOTlryTucgI3ZFZ5IVM16GDSwA0XE0/edit?usp=sharing
내 Google 앱 스크립트 코드는 다음과 같습니다.
function doGet() {
var ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/15fwOeR6Jo4UadzOTlryTucgI3ZFZ5IVM16GDSwA0XE0/edit#gid=0');
SpreadsheetApp.setActiveSpreadsheet(ss);
SpreadsheetApp.setActiveSheet(ss.getSheets()[0]);
var title = ss.getSheets()[0].getRange("A1:A3").getValues();
var link = ss.getSheets()[0].getRange("B1:B3").getValues();
return ContentService.createTextOutput(title).setMimeType(ContentService.MimeType.XML);
}
그러나 배포 할 때 JSON을 얻지 못합니다.
감사합니다.
JSON의 경우 스크립트 위의 반환 부분을 다음 코드로 변경하여 얻을 수 있습니다.
return ContentService.createTextOutput(JSON.stringify(title)).setMimeType(ContentService.MimeType.JSON);
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다