Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
Google Sheets API spreadsheets.values.update no repite el formato

Estoy tratando de crear hojas con Google Sheets API con los siguientes pasos:

  • Cree una hoja de plantilla y formatee la última fila manualmente usando Web GUI
  • Copie esta hoja de plantilla con Drive API
  • Escriba muchas filas en la última fila de la hoja recién copiada con el método de actualización de Sheets API

Este enfoque casi funciona bien, pero no repite el formato de celda. Indique cómo repetir el formato de celda de la última fila automáticamente al agregar filas mediante el método de actualización de Sheets API.

Plantilla de muestra: https://docs.google.com/spreadsheets/d/1MuJCxuSPuwdzjd3eJA5AJ3mIiZ0IXsdu3G-SamTBM_A/

Código de muestra:

 const { google } = require('googleapis') const auth = await google.auth.getClient({ scopes: [ 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/spreadsheets', ], }) const gdrive = google.drive({ version: 'v3', auth }) const res = await gdrive.files.copy({ fileId: '1MuJCxuSPuwdzjd3eJA5AJ3mIiZ0IXsdu3G-SamTBM_A', resource: { name: 'aFileName', parents: ['1aths48cSYq8bA0j1gsYi-Kcp5k4lVOwt'], }, }) const { id: spreadsheetId } = res.data console.log(`Generated sheet: https://docs.google.com/spreadsheets/d/${spreadsheetId}`) const sheets = google.sheets({ version: 'v4', auth }).spreadsheets await sheets.values.update({ spreadsheetId, range: 'A5', valueInputOption: 'USER_ENTERED', resource: { values: [ ['2022-12-28', '8.88', '12'], ['2022/1/10', '3.2', '3'], ['26 Sep 2022', '2.55', '7'], ], }, })

Resultado de muestra: (formato de celda aplicado solo en filas formateadas manualmente): https://docs.google.com/spreadsheets/d/1-CIGOK6GczVZ4qNvsBJKOs0VJeBO8L3kGqYbh1RkC3A/

Gracias.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!