Excel - read data from ODBCbut paste values only - excel

i have an excel document with conditional formatting and data validation lists and lookups.
The users populate this data in Excel.
I then read it into HANA DB and find any new records required to be enriched.
I would like then to be able to refresh the data in Excel with the data i have in HANA however when I go to import via ODBC I then get a table created.
Ideally, it would paste values back into Excel rather than creating a table object as this removed the formatting included originally
Are there ways around this?
Thank you

Create a hidden sheet where you can place your ODBC source table and write a VBA code that will copy and paste new records from ODBC connection to your user-friendly list. You may filter this enriched records via VBA or PowerQuery join or with something like index and match functions.

Related

Connecting different databases in Excel

Let's say I have an Access database, "ADB", and an Excel workbook, "EWB".
ADB has a table called "ATable" which contains columns including a column called "A_ID"
EWB has a worksheet called "EWorksheet" which contains columns "E_ID" and "ECol"
Now, I want to know how I can create an Excel worksheet that combines ATable.A_ID from ADB and EWorksheet.ECol from EWB, where if A_ID = E_ID then return ECol.
So in SQL, it should look something like this:
SELECT ATable.A_ID, EWorksheet.ECol
FROM ADB.ATable, EWB.EWorksheet
WHERE ATable.A_ID = EWorksheet.ECol
Of course I want the data to be dynamic, so that data will be updated when refreshed.
You need something called PowerQuery, in Excel 2016 comes by default. In previous versions you will have to install it.
Once you have it, it´s pretty straightforward. Select a connection as seen below selecting an Access database or an Excel workbook.
Once you have both queries loaded in PowerQuery you need to merge them through the column you specified, and that will make the join for you.
What PowerQuery does is record a set of steps such as connecting to an Access database or merging 2 tables. Those steps are saved within the file, so when you click RefreshAll in Excel it will reproduce those same steps you specified and bring you the latest data.

CSV Connection into Named Table not Range

If you make a data connection to another Excel file or an Access table it will import that data into excel as a Table. This is great! But when I do the same with "From Text" and choose a CSV, it loads no problem, but it loads as a RANGE not a TABLE. This is highly frustrating as I NEED it to be in the table format so that I can take advantage of the dynamic column names.
Am I missing a tickbox somewhere? I'm not opposed to using VBA but it really seems odd that Excel can't do CSV to Table so I'm hoping for a native solution.
I should mention that if it's a VBA solution, it CANT break the workbook. So if I'm doing something like:
=SUMIFS(CSVDATA[SalesDollars], CSVDATA[RepName], "BOB")
It will still work after refreshing.
So you can get around the 'data connection' not creating a table by downloading the MS Excel 2010 plugin (from Microsoft) called Power Query. It's free and is a default feature in MS Excel 2013.
It will allow you to choose to create a Power Query Table from External Data >> From File >> From CSV
Upon doing this, it will create a named table for you and a Power Query object attached to the table. You can use the table itself the same way you normally would - with the Columns as references for formulas.
For instance, the default table that I just created using the steps above was auto-named: Table_ExternalData_1
I can then select it using the normal method in formulas:
=Table_ExternalData_1[Column2]
etc...
Hope that helps.

Has anyone achieved to use ODBC connection from Excel file into Powerpivot?

I have installed Powerpivot for Excel 2010. I don't have Access 2010 so I thought could I arrange the data in the similar manner as I would for a database.
I'm wanting to query an excel file that has rows of self-generated data into Powerpivot in order to perform simple pivot table. In a sense attempt to get an overview of information about a data set.
At the moment, I'm unable to get set up correctly the ODBC I'm hoping I need to accept an Excel file and to get PowerPivot to accept a database from an Excel file.
Edit: I come to understand that I need to set up a table correctly in Excel so that the ODBC works correctly. Does the picture I provided be right manner to set up a table or any other manner?
Has anyone attempted to do this and if so what would the steps be?
Thanks,
Peter.
Peter, I am working on the basis that your data is in a recognizable table on a worksheet (and that you are not interested in using the standard Excel import method through 'From Other Sources')
If you create the connection to the Excel file in a very particular way it is possible to then query it as if it were a database.
Create a Connection to the spreadsheet in question in Excel through Data>Connections>Add.
In the PowerPivot window on the Design tab click on existing connections and find the connection you just created. Select the connection and Open.
You need to name the connection and then you will be offered the normal import options. Select the sheet you want to get the table from (its actually not important which one you choose at this point).
Once the table has been imported you can re-enter the setup through the 'table properties' on the design tab and you will now be able to 'Switch to' the query editor at which point you can not only write SQL to query your DB but reference any other .xlsx you like.
Jacob
the easiest way is to use a linked table from the excel sheet which has the data - is there any reason why you have not considered this as an option?

Excel 2010: Replace a table by an external connection without impacting other sheets

I have a big workbook with a lot of data. In one sheet I have a table. This table is used for many Pivot tables used in other sheets, which are also used in other sheets.
The data for the table was copied manually regularly. I now have a external connection to import automatically the data but I'd like to avoid impacting other sheets.
How can I use my external connection without losing my table?
Thank you for your help
This might be a helpful workaround. I have successfully done this but it may require a bit of rework and not be the exact answer you expect. (I am using Excel 2010).
The reason for a workaround is I assume this is for a regular table (not a pivot table) as the source table. Unfortunately, I don't believe the switching connection options work for regular tables in Excel 2010.
Recreate a new table just below the other in the same worksheet by going to the Data tab > Get External Data > Existing Connections
Select your data connection (assuming it has been created) then select how you want to view the data. ie: Table
Place in your existing worksheet. Use your old table as a reference to reconnect all the connections to your other sheets, then delete the old table.
At this point, I find it easier to rebuild/copy those existing links to the new table with external data.
The good news: If your source table is a pivot table or pivot chart with an existing connection, you can easily change the table to have an external data connection (and switch between data connections).
For a pivot table with an existing connection you wish to change, select a cell in the table. In the ribbon above in 'PivotTable Tools' > Options tab > Change Data Source, you will be able to select this and reconnect to another source under 'Choose connection'.
For a pivot table with static data to introduce a new connection, I would suggest a similar workaround above.
I hope this works for you.
I'm going through this too. I've done some testing, and this is the approach I am going to take.
Save copy of file (just in case!)
Create a new sheet, and create link to your database, and have it entered as a table on this new sheet
Make sure your old table (manually entered) matches the same layout as the table with the data you are connecting to (same column order and column names)
For each pivot table, change the source to the new table (it should keep all of your setup the same if the columns are labeled the same)
Do a find and replace to change all formula referencing to the new table name.
Change any code in VBA that references the old tables
This should result in the least issues while making the changes. Just don't forget the first step!
If both connections/query are SQL or PostgreSQL, you can simply copy the query code from the new query to the old query. Then you do not even have to replace anything. "Edit" - "Advanced editor"

Import additional excel data into Access Table

We need to upload a small amount of additional records to a table from an Excel sheet. Is there a way to use the Access Import function to add the additional data to the table (truncate it). The table was created by uploading the same Excel sheet. But now, when records are added, we need to add them to the table. The tables are linked to SQL but I do not want to use an SSIS because there are only a few records and there must be a way to use Access functions. Suggestions please.
It may be easiest to link the excel sheet and run an append query to add data from Excel to existing table. Once linked, this can be done in the query design window.
You did not specify versions of Excel or Access.
I did this with a test 2003 Excel sheet with cells containing 1000+ characters. An import in Access 2003 detects the data type as a memo field, which is correct, when there are that many characters, so it should work for you. It may be your Excel data has other ingredients causing an import issue. How is the excel data derived?
Have you tried importing to Access? It should work fine. If your ultimate target is another database why use Access as an intermediary?
I agree a linked table seems like a really simple method to update a table if you are using Access, but that is your choice.

Resources