PowerQuery Get Excel Named Variable Which is NOT a Table - excel

I have a named variable in Excel, which not on the workbook itself, which I want to pass to a power query function.
I have been trying to understand how to do so. The only things I found were making use of Excel Table objects.
What if it is not a range at all, just a value, string, whatever which is only stored on name manager?
Do I need to go and put in on the workbook and transform it into a table? I didn't want to have that table editable since I don't need that...
Or can I get access to Excel's Name Manager to fetch a (normal) variable there ?
Thanks !
(In this example, in VBA I would do something like: ThisWorkbook.Names("This_one").Value)

This, from Wyn Hopkins, looks like it might be relevant to your question.

Related

How to change declared variable in OLE DB Query by editing a cell from Excel?

We have different connections and different pivot tables connected to them in our Excel sheet and we don't want to edit them each time using data-> properties-> definitions (editing) to get them updated.
It would be much greater if we had just cells to edit
For example:
And write someting like this:
In my case i get an error of course but maybe you know how avoid it?

Representing data in different way dynamicly

I have this kind of data in excel sheet
I want to have this presented like this:
But dynamically. What do I mean with that?
Well if data change in first picture then data should be changed in second.
For example if I add another value entry for Client2 like this
Then the data in second table should be updated like this:
Is this something that is even possible with just using formulas or will I have to do some VBA programming to achieve this?
Use PivotTables to manage your data.

Excel wouldn't import Access query that contains VBA calls

Access and Excel 2013
Trying to use an Access base as a data source in Excel, it seems like if a query calls a VBA function, Excel doesn't see it.
This query shows up in Excel:
SELECT "StaticValue" AS static_value;
This one doesn't:
SELECT my_function() AS value_from_vba;
The code of the module containing my_function being:
Option Compare Database
Function my_function() As String
my_function = "ValueFromVBA"
End Function
How can I call a VBA function in an Access query and link this query to Excel ?
Hmm perhaps;
Make table and query the table (as stated in comments)
My preferred is just to export the data from access into a new worksheet that you need in excel, then you can do what you want with it if you are only getting values. Then you can go back in and update anything after (in your access tables) with VBA should you need it
I ended up creating a table (SELECT … INTO …) that I refresh on a regular basis. This table is linkable within Excel. It is probably a dirty trick, but it does the job.

Import a single value from Access into Excel (without the column heading)

I would love to know how to import a single value from my Access database into an Excel cell.
Alternatively removing the header would be a good start.
The query
SELECT SUM(DEMANDS) AS TOTAL FROM [DB PROD]
gives me a header named TOTAL and, right below it, the sum I'm interested in. I use this query from within Excel (Data > Get External Data > From Access). How can I only get the sum in a single Excel cell?
One way to accomplish your goal would be to put your existing query on a different Sheet, say Sheet2, so the column header appears in Sheet2!A1 and the value appears in Sheet2!A2. Then reference the value cell from elsewhere in the Excel document. (The formula will look something like =Table_test.accdb[TOTAL].)
If you had several queries you could presumably keep them together (side by side) on the same sheet. You could also hide the query sheet so the "magic" would be more transparent to the user.
I am not sure I understand what you are doing, but, in order to read Access data from Excel, you need to do the following:
programmaticaly open a connexion in your Excel code, pointing to your
access database (let's say an ADO connexion for example)
then execute your 'SELECT' through this connection, using the ADODB.command object. That will return the requested value
another option would be to open a local recordset in Excel,based on your SQL intruction, and read the value.
Then do not forget to close your connexion

Import a single Excel cell into SSIS

Am trying to import a number of metric values from an Excel file into SSIS.
I have named each of the cells with data and was hoping to be able to configure a Connection, that would be updated in a ForEach container, to point to each Named Range in turn, in order to bring over the data one value at a time.
I see many articles on how to connect to a Sheet or Table in Excel, but none to a Named Range? I saw one article on how to bring over one single cell, but that cell was a part of a table.
Can I setup a Connection in SSIS to a single cell, Named or otherwise, and bring back that value?
JK
I can see you implementing this in one of two ways. The first is just a straight Execute SQL Task that returns a single row. The other being a data flow with, probably a script task as your source.
With each pass through your loop, you'd probably need to modify the Excel connection manager and/or your query string to point to the correct named range
In the section To create a linked server against an Excel spreadsheet
To access data from an Excel spreadsheet, associate a range of cells
with a name. A named range can be accessed by using the name of the
range as the table name. The following query can be used to access a
named range called SalesData using the linked server set up in the
previous example.
This article also describes programmatically access Excel via C#, albeit from ASP.NET but the principal should be the same. My hazy recollection is that the worksheet name would have a $ appended to it, thus sheet1$ while accessing the named range would be without the $.
One thing we ran into with our implementation was our servers did not have the appropriate drivers on them and it required us to install the Access engine
Lots of generalities in this answer so if you run into specifics, feel free to ping me.
Take a look at the top two answers from this question:
Want to insert excel file data into table using ssis - format problem
which explains 2 different approaches to doing what you ask.
Here is how to do it http://www.mssqltips.com/sqlservertip/1930/use-ssis-to-import-one-cell-of-an-excel-file-into-sql-server/#comments.
Unfortunately it didn't help me because i want to set a single variable with the values and use it later on.

Resources