Excel Sheet not found Error.

Excel Sheet not found Error.

emilda.chiuye
Enthusiast Enthusiast
1,764 Views
9 Replies
Message 1 of 10

Excel Sheet not found Error.

emilda.chiuye
Enthusiast
Enthusiast

Hello There

This is quite bizarre, the excel worksheet was working fine before I renamed it from "Sheet1" to "New Welds"

I have tried everything from removing spaces between the words placing a number 1 at the end eg "NewWelds1"

I started a whole new spreadsheet and left it as the default "Sheet1" still inventor refuses to co-operate.

Everything was just fine before I renamed the sheet.

I have attached a snippet of the error message in hopes of someone out there understanding exactly what

Inventor is saying to me.

emildachiuye_0-1627999640986.png

Regards

Emilda

0 Likes
Accepted solutions (1)
1,765 Views
9 Replies
Replies (9)
Message 2 of 10

A.Acheson
Mentor
Mentor

How are you calling the excel sheet through ilogic or is it a linked excel sheet to retrieve parameters? Please post the ilogic code if used. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 10

emilda.chiuye
Enthusiast
Enthusiast

Thanks for the response,

Oh yes, ofcourse, I have provided  snippets

xlsPath = "D:\INVENTOR iLogic\Tubes.xlsx"

WELD_AT_TUBE_C_Inlet = GoExcel.CellValue(xlsPath, "NewWelds1", "B17")
FCW1_TUBE_C_INLET = GoExcel.CellValue(xlsPath, "NewWelds1", "B18")

emildachiuye_0-1628001251967.png

 

0 Likes
Message 4 of 10

emilda.chiuye
Enthusiast
Enthusiast

Allow me to add that this is a third sheet in the workbook. 

When I was troubleshooting and started a new sheet I referenced the default "Sheet1" in hopes of Inventor recognizing a single sheet in the work book only, alas, that did not solve the issue.

0 Likes
Message 5 of 10

A.Acheson
Mentor
Mentor
Accepted solution

I was only able to reproduce the error if the excel sheet was missing or mislabeled. Perhaps also if the excel sheet isn't closed fully or has not been saved since the last edit it could throw this error too. 

 

xlsPath = "C:\Desktop\New folder\Test.xlsx"
GoExcel.DisplayAlerts = False

WELD_AT_TUBE_C_Inlet = GoExcel.CellValue(xlsPath, "NewWelds1","A2")
MessageBox.Show(WELD_AT_TUBE_C_Inlet, "Title")

WELD_AT_TUBE_D_Inlet = GoExcel.CellValue(xlsPath, "NewWelds2","A2")
MessageBox.Show(WELD_AT_TUBE_D_Inlet, "Title")

GoExcel.Close
GoExcel.DisplayAlerts = True

 What version of inventor are you using? Are you able to simply open and close a file and see it open in windows and close? 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 6 of 10

emilda.chiuye
Enthusiast
Enthusiast

Thanks a mil, indeed, the excel spreadsheet was missing. Why can't Inventor just say Error: "Xlsx missing" instead of

misleading me with a sheet not found message. 

Blame Inventor for my shortcomings. hahha.

Message 7 of 10

A.Acheson
Mentor
Mentor

Yes unfortunately I wouldn't rely on the error messages being too useful. In this case it is correct it cannot find the sheet but it did not say it couldn't find the workbook / file first. You can either use good old fashioned detective work by steeping through the code with message box or check windows to ensure the file is opening and exists etc

Or maybe build in this snippet if there is a chance the excel book is moving around. 

If(System.IO.File.Exists(xlsPath)) Then
	'Enter excel processing here
Else
	MessageBox.Show("Error Finding Path", "iLogic")
End If

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 8 of 10

hkeny
Explorer
Explorer

Hi all, I am getting the same error. Except my .xlsx file is not missing? I have it saved in my file path that i am calling out in the code. 

hkeny_0-1748882299730.png

hkeny_2-1748882355352.png

Any clue for a fix here? 

 

0 Likes
Message 9 of 10

WCrihfield
Mentor
Mentor

Just guessing here, but have you tried using that 'excelFilePath' variable within the 'GoExcel.CellValues()' call, instead of a separate String containing just the file name?  I know the error seems to be about the sheet name, and not the file name, but just trying to cover one of the steps in the 'process of elimination'.  Also, not sure if capitalization is important for the sheet name, but is 'BOM' capitalized differently in the Excel file, or is it possible that there is a 'space' in the tab name in the Excel (can be hard to see) maybe?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 10 of 10

hkeny
Explorer
Explorer

Thank you @WCrihfield, that seemed to have done the trick, I declared the file path as a String variable but never used it. It is odd because the code seemed to work just fine before I brought the file containing the code into Vault. 

0 Likes