Я выяснил, как читать значения из созданной мною электронной таблицы бюджетирования, но не могу понять, как создать новую электронную таблицу с помощью Sheets API V4.Я уже 5 месяцев борюсь с этой проблемой, кто-нибудь решал эту проблему раньше?
Вот мой код:
// READ - WORKING!
router.get("/get", (req, res) => {
var id = '1LoSF_4Z9aoiVvDsjFV9CMOd--vvz3fERfOPajVb2sv8';
var params = 'https://sheets.googleapis.com/v4/spreadsheets/?key='
var url = params + apiKey;
request(`https://sheets.googleapis.com/v4/spreadsheets/${id}?key=${apiKey}`, (error, response, body) => {
console.log("Body", body);
});
})
// Create - NOT WORKING!
router.post('/create', (req,res)=>{
request({
method: 'POST',
uri: `https://sheets.googleapis.com/v4/spreadsheets?fields=properties%2Ftitle&key=${apiKey}`
}, (error, response, body)=>{
console.log(body);
//Logs the body of the newly created spreadsheet
})
})
Я использовал рекомендации Google Explorer, выможно найти здесь:
https://developers.google.com/apis-explorer/#p/sheets/v4/sheets.spreadsheets.create
Спасибо!