Is it possible to create a cloud function that reads data from a Google spreadsheet with an unlimited range?
The goal is to extract data from the Google spreadsheets and store it in Firebase.
I am aware that in Google sheets you can use something like "Shets1!A2:L".
This is what my function looks like:
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() // Authorization for access
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 implemented this function using TypeScript.
Any solutions or suggestions to solve this issue?