+ Reply to Thread
Results 1 to 5 of 5

How to save workbook as a CSV without it opening.

  1. #1
    Registered User
    Join Date
    09-19-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Windows 10
    Posts
    2

    How to save workbook as a CSV without it opening.

    Hi

    When I save a workbook as CSV, it automatically opens the CSV file. This adds commas etc and the program I'm trying to upload into won't accept it.

    Is there any way to save the file as a CSV without it automatically opening when I click save as??

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to save workbook as a CSV without it opening.

    Whenever you save any file in Excel, the file you just saved is what becomes active in the window. If you save it as a different file type, that is what is now in the active window. This is not specific to csv files.

    By the way, saving a csv file adds commas. It has nothing to do with Excel opening it. That is actually how a csv file is defined. It sounds like maybe you do not actually want a csv file.

    What does your original data look like, and what do you want it to look like in the file you want to save?

    You may need a custom format that is generated by using macros.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-19-2021
    Location
    Melbourne, Australia
    MS-Off Ver
    Windows 10
    Posts
    2

    Re: How to save workbook as a CSV without it opening.

    Hi Jeff,

    Thanks for your reply. Unfortunately it's for an internal HR software system so I can't share a picture, but the format has to be CSV.
    When I attempt to upload the CSV, I get this message:

    Transaction File: There was a problem with the following lines: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126

    Our consultant for the HR software told me it's doing that because I have opened the CSV file, and that I need to upload it without opening it first.

    So basically there is no way to save as a CSV without it opening?

  4. #4
    Forum Contributor
    Join Date
    11-05-2020
    Location
    England
    MS-Off Ver
    365
    Posts
    155

    Re: How to save workbook as a CSV without it opening.

    We use CSV files when we upload information into Sage.

    We have found that when you open a CSV file and save it, it removes "0". I.E if a cost centre is formatted as text "01", when the file is opened it will change the format to general "1" which then means we can't import the information because it is incorrect.

    We have to format the column back to text and add the 0s and either Save as CSV file again or just save. (I think in the older versions of excel you had to save as.)

    Using an older spreadsheet that did manage to import correctly, I would open the document in notepad, you can see how the columns are supposed to look opening the file then change the format of the columns which are incorrect in the spreadsheet.

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to save workbook as a CSV without it opening.

    Quote Originally Posted by zoestephens View Post
    Our consultant for the HR software told me it's doing that because I have opened the CSV file, and that I need to upload it without opening it first.
    Your consultant is either poor at communicating or doesn't know what they're talking about. Merely opening a CSV file has no effect on the content. However, Farly945 may be onto something. If you export to CSV, and then save it again as you close the file, perhaps there is an issue.

    Quote Originally Posted by Farley945 View Post
    I would open the document in notepad, you can see how the columns are supposed to look opening the file then change the format of the columns which are incorrect in the spreadsheet.
    I was also going to recommend this as a diagnostic tool. You may be able to see what's wrong by looking at the data. The error message you showed is woefully inadequate to diagnose what the problem is.

    Here is a small sample of an Excel file:


    A
    B
    C
    1
    This column is formatted as text
    This column has numbers
    This column has numbers too
    2
    01
    1
    001
    3
    01234
    1,234
    012

    The first column is formatted as Text. This forces any number entered to be preserved exactly as entered. You can see that I have some leading zeroes.
    The second column is just numbers, formatted using a comma separator.
    The third column is numbers, with formatting that adds leading zeroes if a number has fewer than three digits.

    I exported it to csv, and this was the result:

    Please Login or Register  to view this content.
    Note that the leading zeroes are preserved in the first column, and the third column. However, note that the second row has a number using the U.S. convention for commas after the thousands' place. This comma forces the export to put quotes around the number so it is not interpreted as two separate numbers. This may be a problem for some programs that try to import this. I am not sure what numbering convention you use in Australia.

    But there can be problems inherent in creating a CSV file when you have not specifically designed your original data file with that in mind.

    My suggestion was not to use a different file type. My suggestion was to use macros to write the CSV file instead of letting Excel do whatever Excel does. You get absolute control of the content that way. But I can't help further without some kind of description of the file format and the data.

+ 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. [SOLVED] Close and Save after inactivity, workbook keep re-opening, save and close, re-open... etc
    By QcHuldar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2020, 02:51 PM
  2. Save the worksheet in .TXT format directly without opening a new workbook?
    By trizzo in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-14-2015, 12:29 PM
  3. [SOLVED] Save listbox selection and repopulate selections when opening workbook
    By BeginnerVBA in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-21-2014, 08:51 AM
  4. Save As Macro runs on opening specific workbook
    By Eline in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2013, 09:04 AM
  5. Disable save and save as upon opening a certain workbook
    By Tino XXL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2011, 01:49 PM
  6. How to save user form checkbox values when opening and closing workbook
    By skfinance in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2011, 06:28 PM
  7. Save worksheet with a cell refference upon opening workbook
    By murthykr72 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-05-2010, 09:13 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