Forum Discussion

Desktopapptesti's avatar
Desktopapptesti
Occasional Contributor
3 years ago

reading data from Excel

Marsha_R  Used below code to read the data from excel file and I am getting file not found error msg.   def ExcelExample(): # Get the sheet of the Excel file excelFile = Excel.Open("C:\\temp\\...
  • npaisley's avatar
    3 years ago

    Hi Desktopapptesti!

     

    Did you create and populate a spreadsheet called 'DataStorageExcel.xlsx' in 'c:\\temp'? 

     

    This will be required for this sample to work. I tried the example on my end was able to open the file without issue after I created it. 

     

    One thing to note here, there is a syntax error in the provided example. 

    Line 16 needs brackets [], instead of parens (). 

     

    Once you are past the file error you may alter line 16 to complete the example; 

    #This line has parens but needs brackets.
    #excelSheet.Cell("C", rowIndex).Value = valueC
    
    #Updated line with brackets.
    excelSheet.Cell["C", rowIndex].Value = valueC

     

    I hope this helps!