+ Reply to Thread
Results 1 to 12 of 12

Add custom column with timestamp

  1. #1
    Registered User
    Join Date
    04-27-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    17

    Add custom column with timestamp

    Hi,

    I am updating data from a csv file using attached code.

    Request help with below …

    1. Need a custom column to be added (say in column V) with timestamp, everytime data is appended

    2. This data is an extract of a code in Python. Is it possible to check every say 5 minutes if data in csv file has changed. If changed, append data to excel with timestamp and if not changed, do nothing.

    Thanks


    Rgds,
    Dhruv
    Attached Files Attached Files

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Add custom column with timestamp

    Possibly with...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-27-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    17

    Re: Add custom column with timestamp

    Thanks a ton for your help. This code does solve part of my problem.

    I would like excel to check every say 5 minutes (if possible between time 9:15am to 3:30pm, everyday) for an updated file (check if file in location (path) is same as last updated file or now, if same then do nothing else update …

    can that be done …

    Thanks

    Regards,
    Dhruv

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Add custom column with timestamp

    I'm not that familiar with this (I use it on just one file), but here's how mine is set up.

    At the end of your sub, call the sub Start_5
    Please Login or Register  to view this content.
    Then place this sub in the same standard module
    Please Login or Register  to view this content.
    ...and then place this sub in the ThisWorkbook code module
    Please Login or Register  to view this content.
    The timer will kick in when the main sub is first run.
    Last edited by dangelor; 06-05-2020 at 08:01 AM. Reason: added "quotation marks around sub name"

  5. #5
    Registered User
    Join Date
    04-27-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    17

    Re: Add custom column with timestamp

    Thank you so much for all your help .. I never knew this forum and its members are this helpful .. really appreciate your help here …

    The code is doing what I wanted but I have to select csv file each time (every 5 mins). Would it possible to just select file once (the 1st time I run the macro) and excel appends from same csv every 5 mins till I stop the macro …

    Thanks again for your help …

    Rgds,
    Dhruv

  6. #6
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Add custom column with timestamp

    Not sure,but this may work...
    Please Login or Register  to view this content.
    ...and make sure this line is at the top of the code module
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-27-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    17

    Re: Add custom column with timestamp

    Hi,

    I am getting attached error message.

    Also the data is getting appended only on the 1st entry of the data table and not for all entries.


    Rgds,
    Dhruv
    Attached Images Attached Images

  8. #8
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Add custom column with timestamp

    Try changing this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-27-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    17

    Re: Add custom column with timestamp

    Hi,

    I made suggested change but excel still asks for the file location post 15 mins. Can you tell me how I can fix filename and path instead of excel asking for location 1st time and then appending for same file. I change the filename everyday in the macro in the morning.

    Rgds,
    Dhruv

  10. #10
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Add custom column with timestamp

    Change the highlighted line to match your file...
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-27-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    17

    Re: Add custom column with timestamp

    I did this .. now the file is updating but in between at times excel is appending data 4 times of the same date and time (same data), immediately after that it would append data of less than 5 mins time and then append actual data which is 5 minutes after the previous correct 5 mins data …

  12. #12
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Add custom column with timestamp

    I would shut down excel completely and retstart it - there may be multiple schedules running. If that doesn't work, I think you should start a new thread with a different title to get some help from someone who is more knowledgable in queries and connections.
    Last edited by dangelor; 06-08-2020 at 10:53 AM. Reason: added a suggestion

+ 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. Help with Code: Timestamp a column under two criteria
    By ironfelix717 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2018, 12:31 AM
  2. Replies: 2
    Last Post: 11-09-2016, 02:23 PM
  3. Replies: 18
    Last Post: 02-24-2014, 06:13 PM
  4. update timestamp if change_event for all column in row
    By dainova in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-07-2012, 01:29 AM
  5. timestamp column not populated
    By jmaikido in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-17-2010, 11:55 PM
  6. Record timestamp in one column automatically
    By springa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2009, 09:38 AM
  7. [SOLVED] Enter timestamp when column is modified
    By Mikus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2005, 01:05 AM

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