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

636
Views
How do I uppercase an entire sheet in Office Scripts Excel (Typescript)?

I was able to do the below in VBA and need to transfer my script to Office Scripts in Excel 365. I can't figure out how to do the whole sheet and not just a string.

This is what I used in VBA:

Dim rng As Range
Set rng = Selection
For Each cell In rng
cell.Value = UCase(cell)
Next cell
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This worked for me, could be a little cumbersome with a lot of cells but should still work.

function main(workbook: ExcelScript.Workbook, worksheetName: string)
{
  let worksheet = workbook.getWorksheet(worksheetName);
  
  // Ge tthe Used Range on the given worksheet and all values.
  let usedRange = worksheet.getUsedRange(false);
  var values = usedRange.getValues();

  // Now loop through each cell and upper case it.
  for (var row = 0; row < values.length; row++) {
    for (var col = 0; col < values[row].length; col++) {
      values[row][col] = values[row][col].toString().toUpperCase();
    }
  }

  usedRange.setValues(values);
}

Note: There is a parameter to the function so it is expected to be used via PowerAutomate/LogicApps but if you don't want that then you should be able to change it up to use the active sheet with relative ease.

e.g. ...

function main(workbook: ExcelScript.Workbook)
{
  let worksheet = workbook.getActiveWorksheet();

  ... continue the rest of the code here ...
}
about 4 years ago · Juan Pablo Isaza Report
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!