<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: OLE DB - Excel Query in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102587#M49287</link>
    <description>Hello!&lt;BR /&gt;&lt;BR /&gt;If you can share a photo or something about your code, we can help you better.&lt;BR /&gt;&lt;BR /&gt;If is your first time using OLEDB libraries, here you have any easy steps to make a simple query in Excel&lt;BR /&gt;&lt;BR /&gt;First one, you need to install the Microsoft OLEDB library, here you have the exe to install it: &lt;A href="https://www.microsoft.com/es-es/download/confirmation.aspx?id=13255" target="_blank" rel="noopener"&gt;https://www.microsoft.com/es-es/download/confirmation.aspx?id=13255&lt;/A&gt;&lt;BR /&gt;(One alternative of this is to donwload externally the DLL)&lt;BR /&gt;&lt;BR /&gt;Then in the Blue Prism Object:&lt;BR /&gt;&lt;SPAN&gt;- add the DLL reference System.Data.OleDb.dll&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- add the Space Name System.Data.OleDb (el de la libreria)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- And, in a new page, add a piece of code:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I recomend you to insert in this code, as input, the name of your Excel File (variable name: excelFile), and the name of the Sheet (variable name: sheetName). And return a collecion (Datatable)&lt;BR /&gt;&lt;BR /&gt;And here is a simple code&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;OleDbConnection connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFile + ";");&lt;BR /&gt;connection.Open();&lt;BR /&gt;&lt;BR /&gt;OleDbCommand command = new OleDbCommand();&lt;BR /&gt;command.Connection = connection;&lt;BR /&gt;command.CommandText = "SELECT * FROM " + sheetName;&lt;BR /&gt;&lt;BR /&gt;DataTable dt = new DataTable();&lt;BR /&gt;dt.Load(command.ExecuteReader());&lt;BR /&gt;&lt;BR /&gt;connection.Close();&lt;BR /&gt;&lt;BR /&gt;Result = dt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In the query, replace "*" for the column name that you want to ask.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this help you.&lt;BR /&gt;&lt;BR /&gt;Bye &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 14 Apr 2021 17:38:53 GMT</pubDate>
    <dc:creator>PabloSarabia</dc:creator>
    <dc:date>2021-04-14T17:38:53Z</dc:date>
    <item>
      <title>OLE DB - Excel Query</title>
      <link>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102586#M49286</link>
      <description>&lt;P&gt;Hello Community,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Hope you're fine! Just started to learn applying OLE DB in BP... I've studied online how to configure queries and I think that I'm understanding it well. However, this is not working and BP answers with this error: "Internal: Could not execute code stage because exception thrown by code stage: Invalid argument."&lt;BR /&gt;&lt;BR /&gt;What I want to do is to extract a single column without headers from excel file... Is anything worng in my query? Could you guys help me out here?&lt;BR /&gt;&lt;BR /&gt;Also, if you know some tutorial content that I should see, I appreciate it!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;
&lt;/P&gt;&lt;P&gt;Thanks for your atention,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rita&lt;/P&gt;
&lt;P&gt;
&lt;/P&gt;&lt;P&gt;&lt;IMG class="img-responsive" data-mce-hlimagekey="336d382e-37d1-e2b2-44e5-683cb7e3d88d" data-mce-hlselector="#ComposeQuestion_f768df1e-17fc-4ac8-85d3-3c0cda10fcfd-tinyMce" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 17:14:28 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102586#M49286</guid>
      <dc:creator>RitaReis_Cabrit</dc:creator>
      <dc:date>2021-04-14T17:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: OLE DB - Excel Query</title>
      <link>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102587#M49287</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;If you can share a photo or something about your code, we can help you better.&lt;BR /&gt;&lt;BR /&gt;If is your first time using OLEDB libraries, here you have any easy steps to make a simple query in Excel&lt;BR /&gt;&lt;BR /&gt;First one, you need to install the Microsoft OLEDB library, here you have the exe to install it: &lt;A href="https://www.microsoft.com/es-es/download/confirmation.aspx?id=13255" target="_blank" rel="noopener"&gt;https://www.microsoft.com/es-es/download/confirmation.aspx?id=13255&lt;/A&gt;&lt;BR /&gt;(One alternative of this is to donwload externally the DLL)&lt;BR /&gt;&lt;BR /&gt;Then in the Blue Prism Object:&lt;BR /&gt;&lt;SPAN&gt;- add the DLL reference System.Data.OleDb.dll&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- add the Space Name System.Data.OleDb (el de la libreria)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- And, in a new page, add a piece of code:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I recomend you to insert in this code, as input, the name of your Excel File (variable name: excelFile), and the name of the Sheet (variable name: sheetName). And return a collecion (Datatable)&lt;BR /&gt;&lt;BR /&gt;And here is a simple code&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;OleDbConnection connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFile + ";");&lt;BR /&gt;connection.Open();&lt;BR /&gt;&lt;BR /&gt;OleDbCommand command = new OleDbCommand();&lt;BR /&gt;command.Connection = connection;&lt;BR /&gt;command.CommandText = "SELECT * FROM " + sheetName;&lt;BR /&gt;&lt;BR /&gt;DataTable dt = new DataTable();&lt;BR /&gt;dt.Load(command.ExecuteReader());&lt;BR /&gt;&lt;BR /&gt;connection.Close();&lt;BR /&gt;&lt;BR /&gt;Result = dt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In the query, replace "*" for the column name that you want to ask.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this help you.&lt;BR /&gt;&lt;BR /&gt;Bye &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Apr 2021 17:38:53 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102587#M49287</guid>
      <dc:creator>PabloSarabia</dc:creator>
      <dc:date>2021-04-14T17:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: OLE DB - Excel Query</title>
      <link>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102588#M49288</link>
      <description>&lt;P&gt;Hello Pablo,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;
&lt;/P&gt;&lt;P&gt;Thanks for your answer and advises!! I'm working for a company that has its' own OLE DB code, so I can not change it... I thought that I had inserted the screenshot, my bad -.-&lt;/P&gt;
&lt;P&gt;
&lt;/P&gt;&lt;P&gt;I'm doing as you said, "&lt;SPAN&gt;In the query, replace "*" for the column name that you want to ask." But somehow the error stills...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;
&lt;/P&gt;&lt;P&gt;
&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://mail.google.com/mail/u/2?ui=2&amp;amp;ik=b3ce9bc5d1&amp;amp;attid=0.1&amp;amp;permmsgid=msg-f:1697037072682063072&amp;amp;th=178d1639efe214e0&amp;amp;view=fimg&amp;amp;sz=s0-l75-ft&amp;amp;attbid=ANGjdJ-O9nc2ujH72ryp-Mhmp9RKqW3nUKMCth7t3YBtQxSwHn5mURFszhMqbDHz7Akrq-mphx_lemaIaiMs-SvE77JxRj1GistoCHJUMEvgJSho6WW8ygnyx1He-EY&amp;amp;disp=emb" class="img-responsive" data-mce-hlimagekey="dc2b0898-142d-e95d-0216-42891fe9b638" data-mce-hlselector="#ReplyToContributedContent_329916b2-bcf3-49a4-bb93-4a1524e09076-tinyMce" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 19:59:10 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102588#M49288</guid>
      <dc:creator>RitaReis_Cabrit</dc:creator>
      <dc:date>2021-04-14T19:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: OLE DB - Excel Query</title>
      <link>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102589#M49289</link>
      <description>Hello Rita,&lt;BR /&gt;&lt;BR /&gt;Sorry, but i can't see the screenshot.&lt;BR /&gt;&lt;BR /&gt;But, I understand that you are making correctly the query.&lt;BR /&gt;&lt;BR /&gt;The problem I think is not in the code, its on the "Piece of code Object". In the code editor you have an error and warning list, can you see your error in that list?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Bye &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 15 Apr 2021 07:01:41 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102589#M49289</guid>
      <dc:creator>PabloSarabia</dc:creator>
      <dc:date>2021-04-15T07:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: OLE DB - Excel Query</title>
      <link>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102590#M49290</link>
      <description>&lt;P&gt;Hello Pablo,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I don't know what is going wrong with screenshot... Im'm sorry... but basicaly my query is: "SELECT * FROM [sheetName$]"&lt;BR /&gt;The original BO that I'm using of OLE DB has no errors or warnings, so looks that everything is fine...&lt;/P&gt;
&lt;P&gt;I have some questions:&lt;BR /&gt;1) are these steps really necessary? I haven't found those settings in BP System [&lt;SPAN&gt;- add the DLL reference System.Data.OleDb.dll; &lt;/SPAN&gt;&lt;SPAN&gt;- add the Space Name System.Data.OleDb (el de la libreria)]&lt;BR /&gt;&lt;BR /&gt;2)I have created a new BO with Set Connection, Open, Get Collection and Execute. Then added the code that you told me, but it appeared 43 errors... apparently a lot of that code strings are not "declared" and due to the high level of protection... what do you think?&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks again for your help!!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 08:59:13 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102590#M49290</guid>
      <dc:creator>RitaReis_Cabrit</dc:creator>
      <dc:date>2021-04-15T08:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: OLE DB - Excel Query</title>
      <link>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102591#M49291</link>
      <description>To use OLEDB you do &lt;STRONG&gt;not&lt;/STRONG&gt; need to do any coding other than creating the SQL statement, which you already have. &lt;BR /&gt;Also, you do not have to create a new object to work with OLEDB, everything you need is already in BP.&lt;BR /&gt;&lt;BR /&gt;Steps to use OLEDB via object &lt;STRONG&gt;Data - OLEDB Extended:&lt;/STRONG&gt;&lt;BR /&gt;
&lt;OL&gt;
&lt;LI&gt;Action:&lt;STRONG&gt; Set Connection&lt;/STRONG&gt;&lt;BR /&gt;Uses a connection string that might look similar to this: &lt;BR /&gt;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyExcel.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES;IMEX=1;";&lt;BR /&gt;Note that you have to replace "C:\MyExcel.xlsx" with the path to you Excel.&lt;BR /&gt;Google 'oledb excel connection string' to find out more about the connection string and its parameters&lt;/LI&gt;
&lt;LI&gt;Action: &lt;STRONG&gt;Open&lt;/STRONG&gt;&lt;BR /&gt;Opens the file for access&lt;/LI&gt;
&lt;LI&gt;Action: &lt;STRONG&gt;Get Collection&lt;/STRONG&gt;&lt;BR /&gt;In: your SQL, format your sheetname with [] and $, such as you already had: &lt;SPAN&gt;[sheetName$]&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Action: &lt;STRONG&gt;Close&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
When I use OLEDB, I restrict the size of the excel to 15k rows. More that this and OLEDB will crash for me. Obviously, the max number of rows varies depending on the number of columns and perhaps memory in the server/computer where you run your process.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Notes:&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;
&lt;UL&gt;
&lt;LI&gt;Your SQL "SELECT * FROM [sheetName$]" should do fine, you can have the * in it and do not have to replace it with the column name(s).&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;The above shows the essentials of OLEDB, for more info you can search this forum.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 20 Apr 2021 11:56:36 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/OLE-DB-Excel-Query/m-p/102591#M49291</guid>
      <dc:creator>PvD_SE</dc:creator>
      <dc:date>2021-04-20T11:56:36Z</dc:date>
    </item>
  </channel>
</rss>

