function main(workbook: ExcelScript.Workbook😞 SelectedValuesToReturn {
let sheet = workbook.getWorksheet("Page 1");
let totalRow: number | undefined;
let RespCellValue: string = sheet.getRange("B3").getValue() as string;
// Ajouter la fonction de recherche
let totalFound = false;
let columnA = sheet.getRange("A01:A50").getValues();
// Obtenir les valeurs de la colonne A
for (let i = 0; i < columnA.length; i++) {
if (columnA[i][0] === "PIECES JOINTES - NUMERO DE DEVIS :") {
totalFound = true;
totalRow = i + 2; // Ajouter 2 pour obtenir le numéro de ligne en dessous
break; // Sortir de la boucle une fois que "total" est trouvé
}
}
let DevisCellValue = sheet.getRange(`A${totalRow}`).getValue() as string;
totalFound = false;
totalRow = null;
for (let i = 0; i < columnA.length; i++) {
if (columnA[i][0] === "TOTAL") {
totalFound = true;
totalRow = i + 1; // Ajouter 1 pour obtenir le numéro de ligne
break; // Sortir de la boucle une fois que "total" est trouvé
}
}
let TotalCellValue = sheet.getRange(`F${totalRow}`).getValue() as number;
return { Devis: DevisCellValue, Total: TotalCellValue, NomResp: RespCellValue }
}
interface SelectedValuesToReturn {
Devis: string,
Total: number;
NomResp: string
}