'How can I create an unlimited range for cloud functions?
I'm creating a cloud function to read a google spreadsheets and I want that use an unlimited range. It´s that possible?
The idea is read the Google spreadsheets and send the data to firebase.
I know that in Google spreadsheets I can use something like this "Shets1!A2:L".
My function it would be something like this:
exports.readsheets_Filmes = functions.https.onRequest(async (request, response) => {
const jwtClient = new google.auth.JWT({
email: serviceAccount.client_email,
key: serviceAccount.private_key,
scopes: ['https://www.googleapis.com/auth/spreadsheets']
})
await jwtClient.authorize() // Autorização para acesso
const {data} = await sheets.spreadsheets.values.get({
auth: jwtClient,
spreadsheetId: "",
range: `Shets!A2:L`,
})
data.values?.forEach(row => {
const [title, main_genre, genre_two] = row
firestore.collection("Filmes").doc().set({
title, main_genre, genre_two
})
})
})
I created this functions using typescript.
Does anyone know how to answer this problem?
Solution 1:[1]
After a long time, I know how to answer this questions.
I made this change and it´s work.
const {data} = await sheets.spreadsheets.values.get({
auth: jwtClient,
spreadsheetId: "",
range: `Shets!A2`,
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rodrigo Fiad Pasini |