+ Reply to Thread
Results 1 to 8 of 8

Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

  1. #1
    Registered User
    Join Date
    01-23-2019
    Location
    Central Mass
    MS-Off Ver
    Access 2003, Excel 2007
    Posts
    3

    Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

    I have to take an excel SS created by another application and turn it into a .csv file. The task has to be automated. What I think I would like to do is create a batch file that I can execute via the MS Task scheduler that will automatically open the file in Excel and then save it as a csv. Is it possible to automate that process somehow?

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

    Re: Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

    See if this helps: http://www.utteraccess.com/wiki/Schedule_a_Macro_to_Run.

    It is a two-step process:
    -You fill out a script file and tell it the path and name to the spreadsheet you want to run and the macro in that spreadsheet to run.
    -The script creates the "program string" that you can copy and paste into the task scheduler.
    -The task scheduler opens the script that has an on open macro that opens the target workbook and executes the macro in it.

    It sounds like in your case you need a spreadsheet to find the other spreadsheet, open it and save it as a CSV file.

    I'd need to know a little bit more about how things are set up. If the program is going to work, it will need to know the name of the file to open. Is the name "predictable," that is, does the file have the same name every day perhaps with a date stamp?

    I am assuming that there is some reason why you want to use the task scheduler for this such as running it so the CSV file will be in place for some other program. I don't think it should take more than a couple of seconds to convert the file.
    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.

  3. #3
    Registered User
    Join Date
    01-23-2019
    Location
    Central Mass
    MS-Off Ver
    Access 2003, Excel 2007
    Posts
    3

    Re: Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

    To answer your questions:

    Yes it'll have the same name.

    This is a monthly process. I'm semi-constrained in the software I have to use, IOW it has to be stuff we
    already have. Our IT Security folks are rather firm on that.

    I'm going to use a package called MARS by Christian Steven software to create the Excel file in a known directory with a known name at a
    known time. There's a package further on down the line that requires a csv file for import. I'm hoping to use Excel in the middle to
    convert the Excel file to a csv.

    This all has to be automated which is why I was hoping to use the Task Scheduler to run a .bat file that will automate the import
    of the Excel file and then export a .csv file. It's as simple as opening the excel file and saving it as a .csv.

    ....at least that's what I came up with. I know its a kludge but logically it should work.

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

    Re: Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

    Here is how you should set it up.

    In the attached, change the path name and file name on Sheet1 to fit your situation. This will be the path and name where the Excel file will be placed.

    Save this file in a convenient place.

    Then use the script program in the link in my previous post.

    Use the path to where you save this file (it may or not be the same place as the downloaded excel file) as the first line in the script.
    Use this file name (XL2CSV.xlsb) in the second line in the scrip
    Use the macro name (ExcelToCSV) in the third line of the script.

    Copy the value in row 11 to notepad.

    Open the task scheduler, when it comes to the point where you run a program, copy in the value you saved to notepad. The task scheduler will pick up that this is an executable with an argument, so click OK.

    Complete filling out the task scheduler.

    In this case, it's a three-legged race: the task scheduler runs the script, the script runs this program, this program opens the target excel file and saves it as CSV.

    You should not have to change anything in the programming; it's all "fill in the blanks."
    Attached Files Attached Files

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

    Re: Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

    To save you from downloading from the link, here is the script file change the name to something descriptive before opening it and filling it in.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-23-2019
    Location
    Central Mass
    MS-Off Ver
    Access 2003, Excel 2007
    Posts
    3

    Re: Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

    Awesome, ty - I'll give it a shot tomorrow when I'm at work.

  7. #7
    Registered User
    Join Date
    05-07-2021
    Location
    Columbia, TN
    MS-Off Ver
    MS office 2016
    Posts
    1

    Re: Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

    Quote Originally Posted by dflak View Post
    Here is how you should set it up.

    In the attached, change the path name and file name on Sheet1 to fit your situation. This will be the path and name where the Excel file will be placed.

    Save this file in a convenient place.

    Then use the script program in the link in my previous post.

    Use the path to where you save this file (it may or not be the same place as the downloaded excel file) as the first line in the script.
    Use this file name (XL2CSV.xlsb) in the second line in the scrip
    Use the macro name (ExcelToCSV) in the third line of the script.

    Copy the value in row 11 to notepad.

    Open the task scheduler, when it comes to the point where you run a program, copy in the value you saved to notepad. The task scheduler will pick up that this is an executable with an argument, so click OK.

    Complete filling out the task scheduler.

    In this case, it's a three-legged race: the task scheduler runs the script, the script runs this program, this program opens the target excel file and saves it as CSV.

    You should not have to change anything in the programming; it's all "fill in the blanks."
    This is interesting and relates to a project I need to complete. I am wondering will this process work in reverse? Can a csv file be saved as an excel file each time a csv file is created (saved in Directory (x) as it were.?

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: Can I use the MS Task Scheduler to automatically create a csv file from an Excel SS

    Administrative Note:

    Hello Tomo453 and Welcome to Excel Forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. Windows task scheduler to automatically open(then close) an excel workbook
    By aprildu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2018, 11:49 PM
  2. Excel macro fail launch automatically in Task Scheduler , but run file manually
    By waihar in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-15-2016, 07:57 PM
  3. Open Excel file using Task Scheduler as Read-Only
    By johncassell in forum Excel General
    Replies: 3
    Last Post: 07-17-2015, 11:42 AM
  4. Task Scheduler Downloading an Empty, Bad File Before Actual File Exists...Not Good
    By jamesdeuce in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-23-2014, 01:25 PM
  5. Running Excel from task scheduler. Scheduler doesn't end
    By tony h in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2013, 09:49 PM
  6. Run Excel and macro using Windows Task Scheduler
    By MilroyD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2013, 11:24 PM
  7. [SOLVED] Use Task Scheduler to automatically run Excel workbook
    By John Hazel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2006, 09:10 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