My code is generating the following string to insert data into the Excel spreadsheet. Can you see what is causing the exception "OleDBException" with the message "Cannot expand named range." to be thrown?
INSERT INTO [Sheet1$B2:B2](F1) VALUES(34.5)
I've also tried putting square brackets around F1 like so: INSERT INTO [Sheet1$B2:B2]([F1]) VALUES(34.5)
I am also curious why if I just pass B2: INSERT INTO [Sheet1$B2](F1) VALUES(34.5) I will get an error "Microsoft Jet Database Engine could not find the object 'Sheet1$B2'".
I am using a normal spreadsheet with two columns and many rows. All of the cells are unlocked and filled with numbers (except the topmost cell of each column, which has a title).
Start Free Trial