DEV Community

Gorkes
Gorkes

Posted on

react native com google sheets

Preciso colocar o retorno em uma variável para exibir outro componente, só estou conseguindo visualizar o retorno no console.log

const GoogleSpreadsheet = require ('google-spreadsheet')
const credentials = require('./src/credentials.json')
const { promisify } = require('util')

const docId = '1RPWKohhPnHwoH78wrU0VtSaW_zj91kW_oKrAdWktLjY'

const accessSheet = async() => {
const doc = new GoogleSpreadsheet(docId)
await promisify(doc.useServiceAccountAuth)(credentials)
const info = await promisify(doc.getInfo)()
const worksheet = info.worksheets[0]

// select row
const rows = await promisify(worksheet.getRows)({
query: 'imei = 121545465456'
})
rows.forEach(row => {
console.log(row.status)
})
}
accessSheet()

Top comments (0)