+ Reply to Thread
Results 1 to 7 of 7

Trying to batch process .csv files to delete 3rd line in file

  1. #1
    Registered User
    Join Date
    09-15-2019
    Location
    Minnesota
    MS-Off Ver
    2010
    Posts
    3

    Trying to batch process .csv files to delete 3rd line in file

    Hello,
    We receive thousands of files from our clients and in order to do our processes using the files we have to open each file individually, select Line 3, delete it and resave file (make a copy) in the same folder with a new prefix of "2_" (Not the quotations marks in the name, just the 2_) so we don't overwrite the original file. I've been trying to see if there are any batch programs out there to use, but I'm not finding anything suitable. Any ideas? It's Excel 2010 running on a PC running Windows 7 Professional.I'm not code-savvy at all. Thanks, SJK

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    12,802

    Re: Trying to batch process .csv files to delete 3rd line in file

    Welcome to the forum

    Please 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.

  3. #3
    Registered User
    Join Date
    09-15-2019
    Location
    Minnesota
    MS-Off Ver
    2010
    Posts
    3

    Re: Trying to batch process .csv files to delete 3rd line in file

    Attached are a before and after examples. Thanks for your help. SJK
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,040

    Re: Trying to batch process .csv files to delete 3rd line in file

    You need to change the file path to the folder you are interested, and I am sure there are quicker ways. I would personally save to another folder for the copies and move the originals to another folder so you do no process files twice



    but the below code in a module is a start
    Please Login or Register  to view this content.
    Last edited by davsth; 09-16-2019 at 07:49 AM.

  5. #5
    Registered User
    Join Date
    09-15-2019
    Location
    Minnesota
    MS-Off Ver
    2010
    Posts
    3

    Re: Trying to batch process .csv files to delete 3rd line in file

    Here's the edits I made to the file, Something isn't working, I'm sure I'm not making the proper edits. I'm not really sure what I'm doing.

    Here it is:

    Please Login or Register  to view this content.
    I had created a new folder on the desktop and put the .bat file and the file I wanted to edit in that same folder, Doesn't appear to be doing anything, of course all the info flashes by so fast, I can't tell what's wrong with it.
    Last edited by Pepe Le Mokko; 09-16-2019 at 11:54 AM.

  6. #6
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,040

    Re: Trying to batch process .csv files to delete 3rd line in file

    You have to put the code in an excel spreadsheet xls or xlsm in a module

    then you run the code from the spreadsheet. The below link may help you with that
    https://www.ablebits.com/office-addi...a-macro-excel/

    However for the future you need to put code inside the # marks to make it appear like mine did in the blue/grey box

    Your mistake was not including the \ in the path

    Please Login or Register  to view this content.

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    12,802

    Re: Trying to batch process .csv files to delete 3rd line in file

    @Daily

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time

+ 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. Monitoring utility for a Batch Process
    By ImranBhatti in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-14-2018, 12:49 PM
  2. Inputting single file information instead of batch files
    By Fusion187 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-07-2017, 11:17 AM
  3. Multiple files to 1 'master' file - best process??
    By RossInk in forum Excel General
    Replies: 1
    Last Post: 12-19-2013, 12:49 PM
  4. [SOLVED] Batch job. Open a lot of excel files, delete the same values from each, save, then close
    By greendale in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-06-2013, 03:31 PM
  5. [SOLVED] Adapt macro to batch process files
    By beng404 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2012, 07:09 PM
  6. Reverse Geocode Batch Process
    By ernestgoh in forum Excel General
    Replies: 0
    Last Post: 01-19-2010, 03:35 PM
  7. [SOLVED] Batch file to start multiple excel files with auto_open() macro. Delay code needed
    By pierrelap@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-29-2005, 02: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