Forum Discussion
BRANDON1385
Mar 27, 2024Copper Contributor
SCRIPT EXCEL
1. First start with "ORANGE" -worksheet-, but I need switch to "BLACK" -worksheet-, to replace more information. I tried with a) let dataWorksheet = workbook.getWorksheet("BLACK"); dataWor...
SergeiBaklan
Mar 28, 2024Diamond Contributor
Nice solution. I'd only not to hardcode sheet names within formula, something like
function main(workbook: ExcelScript.Workbook) {
const names = ["BLACK", "ORANGE"]
workbook.getWorksheets()
.filter( q => names.includes(q.getName()))
.map( w => w.getRange("H:H").getUsedRange()
.replaceAll("A.REY", "A. REY",
{ completeMatch: false, matchCase: false }
)
)
}
Also better the range name to move outside if only only we won't apply to entire used range within the sheet.
rachel
Mar 29, 2024Iron Contributor
Thank you so much! that is much cleaner. When I code in c#, I relied heavily on the intellisense of JetBrain Rider to automatically convert my for loop to linq etc. so when I started to write this script, I felt so good because the intellisense is much better than I expected and colour theme is dark, but then I felt handicapped when I realised it won't automatically help me refactor my code. so I actually ended up spending half of my morning googling the translation from C# Linq to Javascript to write this.
- SergeiBaklanMar 29, 2024Diamond Contributor
Lot of technologies involved. C#, Rider, Linq, TypeScript and finally Excel. Impressive!
- rachelMar 29, 2024Iron ContributorMost IT professionals can grasp the basics of a new programming language within days...but it just take lots of experience to develop a fine taste in Excel. Probably because there is no shortcut such as intellisense or debugging tools for those excel formulas
- SergeiBaklanMar 29, 2024Diamond Contributor
AFE could help a bit, now it's even with kind of debugger. Not an IDE, but compare to formula bar that's a great progress.