How to use the gsheets.getWorksheetById function in gsheets

To help you get started, we’ve selected a few gsheets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github durancristhian / futbol / scripts / generate-dataset.js View on Github external
.getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_COVERS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_CURIOSITIES_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data)
  ];

  if (process.env.REACT_APP_SHIRTS_WORKSHEET_ID) {
    dataPromises.push(
      gsheets
        .getWorksheetById(
          process.env.REACT_APP_SPREADSHEET_ID,
          process.env.REACT_APP_SHIRTS_WORKSHEET_ID
        )
        .then((worksheet) => worksheet.data)
    );
  }

  Promise.all(dataPromises)
    .then(async ([covers, curiosities, shirts]) => {
      // guardo la información en disco para ser usado desde la app
      fs.writeFileSync(
        path.resolve('./', 'src', 'dataset.json'),
        JSON.stringify(
          {
            positions: await calculatePositions(),
github durancristhian / futbol / src / js / app.js View on Github external
.getWorksheetById(process.env.SPREADSHEET_ID, process.env.POSITIONS_WORKSHEET_ID)
            .then((worksheet) => worksheet.data),
        // obtenemos las portadas
        gsheets
            .getWorksheetById(process.env.SPREADSHEET_ID, process.env.COVERS_WORKSHEET_ID)
            .then((worksheet) => worksheet.data),
        // obtenemos las curiosidades
        gsheets
            .getWorksheetById(process.env.SPREADSHEET_ID, process.env.CURIOSITIES_WORKSHEET_ID)
            .then((worksheet) => worksheet.data),
    ];

    if (process.env.SHIRTS_WORKSHEET_ID) {
        dataPromises.push(
            // obtenemos las camisetas
            gsheets
                .getWorksheetById(process.env.SPREADSHEET_ID, process.env.SHIRTS_WORKSHEET_ID)
                .then((worksheet) => worksheet.data)
        );
    }

    Promise.all(dataPromises)
        .then(([positions, covers, curiosities, shirts]) => {
            setTimeout(() => {
                // renderizamos las posiciones
                renderPositions(positions);
                // renderizamos las portadas
                renderCovers(covers);
                // renderizamos las camisetas si existen
                if (shirts) renderShirts(shirts);
                // renderizamos las curiosidades si existen
                if (curiosities && curiosities.length) {
github durancristhian / futbol / src / js / app.js View on Github external
} else {
        // el tema no es válido. Guardamos uno por defecto y lo asignamos al DOM
        themeManager.saveAndAssignTheme('theme-yellow');
    }

    const dataPromises = [
        // obtenemos las posiciones
        gsheets
            .getWorksheetById(process.env.SPREADSHEET_ID, process.env.POSITIONS_WORKSHEET_ID)
            .then((worksheet) => worksheet.data),
        // obtenemos las portadas
        gsheets
            .getWorksheetById(process.env.SPREADSHEET_ID, process.env.COVERS_WORKSHEET_ID)
            .then((worksheet) => worksheet.data),
        // obtenemos las curiosidades
        gsheets
            .getWorksheetById(process.env.SPREADSHEET_ID, process.env.CURIOSITIES_WORKSHEET_ID)
            .then((worksheet) => worksheet.data),
    ];

    if (process.env.SHIRTS_WORKSHEET_ID) {
        dataPromises.push(
            // obtenemos las camisetas
            gsheets
                .getWorksheetById(process.env.SPREADSHEET_ID, process.env.SHIRTS_WORKSHEET_ID)
                .then((worksheet) => worksheet.data)
        );
    }

    Promise.all(dataPromises)
        .then(([positions, covers, curiosities, shirts]) => {
            setTimeout(() => {
github durancristhian / futbol / scripts / fetch-spreadsheet.js View on Github external
.getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_COVERS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_CURIOSITIES_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data)
  ];

  if (process.env.REACT_APP_SHIRTS_WORKSHEET_ID) {
    dataPromises.push(
      gsheets
        .getWorksheetById(
          process.env.REACT_APP_SPREADSHEET_ID,
          process.env.REACT_APP_SHIRTS_WORKSHEET_ID
        )
        .then((worksheet) => worksheet.data)
    );
  }

  Promise.all(dataPromises)
    .then(([positions, covers, curiosities, shirts]) => {
      // guardo la información en disco para ser usado desde la app
      fs.writeFileSync(
        path.resolve('./', 'src', 'dataset.json'),
        JSON.stringify(
          {
            positions: addInfoToPositions(positions),
github durancristhian / futbol / scripts / fetch-spreadsheet.js View on Github external
async function generateData() {
  const dataPromises = [
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_POSITIONS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_COVERS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_CURIOSITIES_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data)
  ];

  if (process.env.REACT_APP_SHIRTS_WORKSHEET_ID) {
    dataPromises.push(
      gsheets
github durancristhian / futbol / scripts / fetch-spreadsheet.js View on Github external
async function generateData() {
  const dataPromises = [
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_POSITIONS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_COVERS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_CURIOSITIES_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data)
  ];

  if (process.env.REACT_APP_SHIRTS_WORKSHEET_ID) {
    dataPromises.push(
      gsheets
        .getWorksheetById(
          process.env.REACT_APP_SPREADSHEET_ID,
          process.env.REACT_APP_SHIRTS_WORKSHEET_ID
        )
        .then((worksheet) => worksheet.data)
    );
github durancristhian / futbol / src / App / App.js View on Github external
.getWorksheetById(
          process.env.REACT_APP_SPREADSHEET_ID,
          process.env.REACT_APP_COVERS_WORKSHEET_ID
        )
        .then((worksheet) => worksheet.data),
      gsheets
        .getWorksheetById(
          process.env.REACT_APP_SPREADSHEET_ID,
          process.env.REACT_APP_CURIOSITIES_WORKSHEET_ID
        )
        .then((worksheet) => worksheet.data)
    ];

    if (process.env.REACT_APP_SHIRTS_WORKSHEET_ID) {
      dataPromises.push(
        gsheets
          .getWorksheetById(
            process.env.REACT_APP_SPREADSHEET_ID,
            process.env.REACT_APP_SHIRTS_WORKSHEET_ID
          )
          .then((worksheet) => worksheet.data)
      );
    }

    Promise.all(dataPromises)
      .then(([positions, covers, curiosities, shirts]) => {
        this.setState({
          dataset: { positions, covers, curiosities, shirts },
          loading: false
        });
      })
      .catch(() => {
github durancristhian / futbol / scripts / fetch-spreadsheet.js View on Github external
async function generateData() {
  const dataPromises = [
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_POSITIONS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_COVERS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_CURIOSITIES_WORKSHEET_ID
      )
github durancristhian / futbol / scripts / generate-dataset.js View on Github external
function generateDataset() {
  const dataPromises = [
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_COVERS_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data),
    gsheets
      .getWorksheetById(
        process.env.REACT_APP_SPREADSHEET_ID,
        process.env.REACT_APP_CURIOSITIES_WORKSHEET_ID
      )
      .then((worksheet) => worksheet.data)
  ];

  if (process.env.REACT_APP_SHIRTS_WORKSHEET_ID) {
    dataPromises.push(
      gsheets
github durancristhian / futbol / src / App / App.js View on Github external
componentDidMount() {
    const dataPromises = [
      gsheets
        .getWorksheetById(
          process.env.REACT_APP_SPREADSHEET_ID,
          process.env.REACT_APP_POSITIONS_WORKSHEET_ID
        )
        .then((worksheet) => worksheet.data),
      gsheets
        .getWorksheetById(
          process.env.REACT_APP_SPREADSHEET_ID,
          process.env.REACT_APP_COVERS_WORKSHEET_ID
        )
        .then((worksheet) => worksheet.data),
      gsheets
        .getWorksheetById(
          process.env.REACT_APP_SPREADSHEET_ID,
          process.env.REACT_APP_CURIOSITIES_WORKSHEET_ID
        )
        .then((worksheet) => worksheet.data)
    ];

    if (process.env.REACT_APP_SHIRTS_WORKSHEET_ID) {
      dataPromises.push(
        gsheets

gsheets

Get public Google Spreadsheets as plain JavaScript/JSON

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

49 / 100
Full package analysis