Just found another way to this, this logic is by creating office script in excel and running it by passing year as input parameter.
Logic could have been built by power automate cloud flow itself as i think but may be flow becomes quite complicated. Keeping simple- we can try with office script.
1. Create an excel file and write the following office script
function main(workbook: ExcelScript.Workbook, inputNumber: number): string {
// Convert the number to words and return the result
return numberToWords(inputNumber);
}
// Helper function to convert number to words
function numberToWords(number: number): string {
if (number === 0) return "zero";
const units = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
const teens = ["", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"];
const tens = ["", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
const thousands = ["", "thousand", "million", "billion"];
let words = "";
let thousandCounter = 0;
while (number > 0) {
let chunk = number % 1000;
if (chunk > 0) {
let chunkWords = convertChunk(chunk);
words = chunkWords + " " + thousands[thousandCounter] + " " + words;
}
number = Math.floor(number / 1000);
thousandCounter++;
}
console.log(words);
return words.trim();
function convertChunk(chunk: number): string {
let chunkWords = "";
if (chunk >= 100) {
chunkWords += units[Math.floor(chunk / 100)] + " hundred ";
chunk %= 100;
}
if (chunk >= 11 && chunk <= 19) {
chunkWords += teens[chunk - 10] + " ";
} else {
chunkWords += tens[Math.floor(chunk / 10)] + " ";
chunk %= 10;
chunkWords += units[chunk] + " ";
}
return chunkWords.trim();
}
}
Now create a flow something like below
the result will contain output in word format of the number like below
Hope it helps !
Mark it as solution if it resolves your query !
Thanks & Regards,
Nived N