Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

188
Visualizações
How to get data from range to empty column

I have sheet and data, but I don't know how many filled columns will be in sheet. I need data from 3 to 5 row and from columns A to (dynamic, for each sheet could be different).

If I have data in Table it is easy, but I don't know how it looks like in Range.

async function getData() {
  await Excel.run(async (context) => {
    const sheet = context.workbook.worksheets.getItem("Sample");
    const expensesTable = sheet.tables.getItem("Table"); 

    const headerRange = expensesTable.getHeaderRowRange().load("values");
    const bodyRange = expensesTable.getDataBodyRange().load("values");

    await context.sync();
    console.log(JSON.stringify(headerRange, null, 4))
    console.log(JSON.stringify(bodyRange.values, null, 1));
  });
}
about 4 years ago · Santiago Gelvez
2 Respostas
Responde à pergunta

0

Note: Used Range is 0 index from the range itself. So if data starts in Cell A1 then Col A = 0 Row 1 = 0. If data starts in B1 then data in B1 would be 0,0.

async function getData() {
    await Excel.run(async (context) => {
        var ws = context.workbook.worksheets.getActiveWorksheet();
        var usedrng = ws.getUsedRange(true)
        usedrng.load("values")
        await context.sync()

        var val = usedrng.values[0][0]
        console.log('val:' + val)
    });
}
about 4 years ago · Santiago Gelvez Relatório

0

If you want to find the most right non-empty column, you may use Range.getExtendedRange with right direction. It returns a range object that includes the current range and up to the edge of the range, based on the provided direction. This matches the Ctrl+Shift+Arrow key behavior in the Excel on Windows UI.

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda