Forum Discussion

nedbacan's avatar
nedbacan
Frequent Contributor
2 years ago

Adding data stored in different variables in various scripts into one spreadsheet.

I have different scripts that capture data from different on-screen label element of the application and assign it to a global variable. How can I get them all into one Spreadsheet?  Would I need t...
  • rraghvani's avatar
    2 years ago

    See Excel Object, and it will be something similar to this

    function PatientDetails()
    {
        // Get the sheet of the Excel file
        var excelFile = Excel.Open("C:\\Temp\\PatientDetails.xlsx");
        var excelSheet = excelFile.SheetByTitle("Sheet1");
          
        // Write the obtained data into a new row of the file
        var rowIndex = excelSheet.RowCount + 1;
        excelSheet.Cell("A", rowIndex).Value = // GetPatientID;
        excelSheet.Cell("B", rowIndex).Value = // GetPatientName;
        excelSheet.Cell("C", rowIndex).Value = // GetPatientDOB;
        excelFile.Save();
    }