30-03-23 08:59 AM
Hello,
I'm trying to get the data using the query from the OLEDB
"select * from [Sheet1$]"
but I have the worksheet Name as Dynamic as it changes everyday. This is my worksheet name Prepaid 9220 and it's changes everyday
Could you please help with the SQl query to get the data with the Dynamic worksheet ?
30-03-23 01:55 PM
If there is a logic behind the worksheet name, store the query in a text Data Item and the Worksheet name on another Data Item. Add some logic to set the name of the worksheet via a calculation stage. Add another calculation stage after that to amend the OLEDB query accordingly.
Another option would be to open the excel file and use the Action 'Get Worksheet Name' , assuming the target worksheet is always placed on the same position. Store the output of said action on a Data Item (e.g. 's_WorksheetName') and then close both workbook and excel instance (technically you only need to close the WB, but just to be on the safe side).
Then, build the query via calculation stage like this "SELECT * FROM ["& [s_WorksheetName] &"$]"
Hope this helps.
30-03-23 02:02 PM
Hi Ramón Requena López,
Thanks for your response.
I have applied the above mentioned 2nd method and it's working fine for me.
Thank you.