DEV Community

Gorkes
Gorkes

Posted on

1 1

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)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay