+ Reply to Thread
Results 1 to 2 of 2

Import CSV into existing table - overwrite contents from old CSV

  1. #1
    Registered User
    Join Date
    11-14-2018
    Location
    Germany
    MS-Off Ver
    Office 2013 (Business) / Office 365 (Private)
    Posts
    1

    Import CSV into existing table - overwrite contents from old CSV

    Hi all,

    I am currently struggling with the following issue and I can't seem to find anything fitting.

    I have a spreadsheet, one table (named table 'LogTable') which I prefilled from a CSV. The table itself should contain the CSV contents (separated) in the first columns, the other columns are calculated.

    Excel automatically creates four connections:
    - Connection
    - log1 (which points to the CSV, but says "Not used in this workbook"
    - ThisWorkbookDataModel
    - WorksheetConnection_Test.xlsx!LogTable

    I would like to be able to change the CSV (which always has the same format), so the contents of the table get automatically updated.

    Once I made it work, but I can't remember how. The workaround is bad, as it breaks my references in the caluclated cells:
    - Convert to range
    - Import CSV via Get External Data (which is greyed out if it is not a range)

    Is this even something I can do?

    Thanks for any hints,

    MMF

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Import CSV into existing table - overwrite contents from old CSV

    There are three ways I can think of doing this.

    Use VBA to clear the table and then copy / paste the contents of the CSV file into the now-blank table. This has the advantage of being flexible such as when the CSV file has some sort of a constant "root" name and a predictable date stamp.

    If you have MS-Access, then create a link to the CSV file. Write a query in MS-Access and then connect to the query as an external data source. This works particularly well when the new file is named the same every day. Otherwise some VB would be required to change the connection.

    Use MS-Query: First do a one-time creation of a directory as a text data source. I can provide documentation with screen captures for this. Then use MS-Query to connect to this data source. I can give you instructions on that too. Then it is simply a matter of selecting which table you want (any text file in the directory) and drag and drop the fields in a fashion similar to using an MS-Access query interface. You can then even have the connection refresh automatically when the file opens. This method has the same limitation as MS-Access if the file name changes daily.

    Which sounds like it would work for you? Method 1 is rather simple to implement if you don't mind having a macro-enabled workbook.

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Overwrite existing cells
    By Mulberry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2015, 11:57 PM
  2. How do you update existing data in a table with an import?
    By rschoenb in forum Access Tables & Databases
    Replies: 3
    Last Post: 02-12-2015, 02:10 PM
  3. Import table contents from a hyperlink to the right column
    By FusionPwN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-07-2014, 11:09 AM
  4. How to overwrite data in a table on a new import.
    By AlphaSkidz in forum Access Tables & Databases
    Replies: 7
    Last Post: 11-25-2013, 06:42 PM
  5. Overwrite existing data
    By kishoremcp in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-21-2012, 09:10 PM
  6. Import Access Table contents with criteria.
    By JapanDave in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-30-2011, 11:05 PM
  7. Replies: 0
    Last Post: 03-02-2006, 12:10 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1