Safest Way to Convert Hundreds of *.xls to *.ods

Page 3 of 3 FirstFirst 123

  1. Posts : 148
    Win 10 Pro - 1903
    Thread Starter
       #21

    bro67 said:
    You need \\ after c: or it is not going to work.
    Thank you, bro67...here's the same result:

    C:\Fiddle>for %%f in (*.xls) do "c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%%f"
    %%f was unexpected at this time.

    C:\Fiddle>

    Again, the bold red text was the error message I received. So, I'm again stymied. Got another idea?
      My Computers


  2. Posts : 9,788
    Mac OS Catalina
       #22

    Try it with cmd.exe as admin. See method 3: https://docs.microsoft.com/en-us/off...rmats-in-excel. Make Sure that Libre Office is closed and that you are using the correct path for Libre Office and the .exe. convert-to command line parameter - Ask LibreOffice

    You can also convert individual at Convert Files - Free XLS to ODS converter. Free online document converter.
    XLS to ODS Converter to Convert Excel to OpenOffice Spreadsheet ODS
      My Computer


  3. Posts : 148
    Win 10 Pro - 1903
    Thread Starter
       #23

    bro67 said:
    Try it with cmd.exe as admin. See method 3: https://docs.microsoft.com/en-us/off...rmats-in-excel. Make Sure that Libre Office is closed and that you are using the correct path for Libre Office and the .exe. convert-to command line parameter - Ask LibreOffice

    You can also convert individual at Convert Files - Free XLS to ODS converter. Free online document converter.
    XLS to ODS Converter to Convert Excel to OpenOffice Spreadsheet ODS
    This error message
    %%f was unexpected at this time
    tell me that something's wrong with the line of code we've been considering.

    The same error message happens with cmd.exe as admin and with Elevated Command icon pinned to task bar.
      My Computers


  4. Posts : 301
    Windows 11 - Ver: 22H2 - Build: 22621.1105
       #24

    @Florida Rene, try replacing
    Code:
    %%f
    with
    Code:
    %f
      My Computer


  5. Posts : 148
    Win 10 Pro - 1903
    Thread Starter
       #25

    sbh7600 said:
    @Florida Rene, try replacing
    Code:
    %%f
    with
    Code:
    %f
    Thank you. I tried. Didn't convert the files to ods. Did convert some (not even half) of the files to xlsx. Here's the result:

    Microsoft Windows [Version 10.0.18362.295]
    (c) 2019 Microsoft Corporation. All rights reserved.

    C:\Users\Pc>cd\

    C:\>cd fiddle

    C:\Fiddle>for %f in (*.xls) do "c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%%f"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-03-25.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-03-26.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-03-30.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-04-01.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-04-15.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-04-16.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-04-18.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-04-25.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-04-26.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-04-30.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-05-02.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-05-05.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%- S FDDW Checking 2013-05-09.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2013 FDDW P&L 2013-10-31 - 92.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2013 FDDW P&L 2013-11-09 - 91.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2015 FDDW - YTD - 2015-06-30.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2015 FDDW - YTD - 2015-09-30 VFW Note.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2015 FDDW - YTD - 2015-11-30.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2015 FDDW - YTD - 2015-12-31.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2015 HP Schedule (1).xlsx"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2015 HP Schedule.xlsx"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2016 FDDW - YTD - 2016-05-18.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%2016 FDDW - YTD - 2016-10-26.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%Calendar HP Spring 2014.xlsx"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%chasedeco&decojanuary2013pricelist.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%Fall2013PriceListExcelWholesale.xlsx"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%FDDW - YTD - FORM.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%FDDW Sales Per Client 2014-2016 E.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%FDDW VENDOR Phones & Faxes 2014-09-16.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%FDDW VENDOR Phones & Faxes 2016-11-29.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%revise return (1).xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%revise return.xls"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%STOCK ON HAND SEPT 13 2012 (1).xlsx"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%STOCK ON HAND SEPT 13 2012 (2).xlsx"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%STOCK ON HAND SEPT 13 2012 (3).xlsx"

    C:\Fiddle>"c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%STOCK ON HAND SEPT 13 2012.xlsx"

    C:\Fiddle>
      My Computers


  6. Posts : 301
    Windows 11 - Ver: 22H2 - Build: 22621.1105
       #26

    did you replace both
    Code:
    %%f
    with
    Code:
    %f
      My Computer


  7. Posts : 148
    Win 10 Pro - 1903
    Thread Starter
       #27

    sbh7600 said:
    did you replace both
    Code:
    %%f
    with
    Code:
    %f
    No...but following your post above, I did...and this was the result:

    C:\Fiddle>for %f in (*.xls) do "c:\\Program Files\libreoffice\program\soffice.exe" --convert-to ods "%f"
    Using without special arguments:
    Opens the start center, if it is used without any arguments.
    {file} Tries to open the file (files) in the components
    suitable for them.
    {file} {macro:///Library.Module.MacroName}
    Opens the file and runs specified macros from
    the file.

    Getting help and information:
    --help | -h | -? Shows this help and quits.
    --helpwriter Opens built-in or online Help on Writer.
    --helpcalc Opens built-in or online Help on Calc.
    --helpdraw Opens built-in or online Help on Draw.
    --helpimpress Opens built-in or online Help on Impress.
    --helpbase Opens built-in or online Help on Base.
    --helpbasic Opens built-in or online Help on Basic scripting
    language.
    --helpmath Opens built-in or online Help on Math.
    --version Shows the version and quits.
    --nstemporarydirectory
    (MacOS X sandbox only) Returns path of the temporary
    directory for the current user and exits. Overrides
    all other arguments.

    General arguments:
    --quickstart[=no] Activates[Deactivates] the Quickstarter service.
    --nolockcheck Disables check for remote instances using one
    installation.
    --infilter={filter} Force an input filter type if possible. For example:
    --infilter="Calc Office Open XML"
    --infilter="Text (encoded):UTF8,LF,,,"
    --pidfile={file} Store soffice.bin pid to {file}.
    --display {display} Sets the DISPLAY environment variable on UNIX-like
    platforms to the value {display} (only supported by a
    start script).

    User/programmatic interface control:
    --nologo Disables the splash screen at program start.
    --minimized Starts minimized. The splash screen is not displayed.
    --nodefault Starts without displaying anything except the splash
    screen (do not display initial window).
    --invisible Starts in invisible mode. Neither the start-up logo nor
    the initial program window will be visible. Application
    can be controlled, and documents and dialogs can be
    controlled and opened via the API. Using the parameter,
    the process can only be ended using the taskmanager
    (Windows) or the kill command (UNIX-like systems). It
    cannot be used in conjunction with --quickstart.
    --headless Starts in "headless mode" which allows using the
    application without GUI. This special mode can be used
    when the application is controlled by external clients
    via the API.
    --norestore Disables restart and file recovery after a system crash.
    --safe-mode Starts in a safe mode, i.e. starts temporarily with a
    fresh user profile and helps to restore a broken
    configuration.
    --accept={connect-string} Specifies a UNO connect-string to create a UNO
    acceptor through which other programs can connect to
    access the API. Note that API access allows execution
    of arbitrary commands.
    The syntax of the {connect-string} is:
    connection-type,params;protocol-name,params
    e.g. pipe,name={some name};urp
    or socket,host=localhost,port=54321;urp
    --unaccept={connect-string} Closes an acceptor that was created with
    --accept. Use --unaccept=all to close all acceptors.
    --language={lang} Uses specified language, if language is not selected
    yet for UI. The lang is a tag of the language in IETF
    language tag.

    Developer arguments:
    --terminate_after_init
    Exit after initialization complete (no documents loaded).
    --eventtesting Exit after loading documents.

    New document creation arguments:
    The arguments create an empty document of specified kind. Only one of them may
    be used in one command line. If filenames are specified after an argument,
    then it tries to open those files in the specified component.
    --writer Creates an empty Writer document.
    --calc Creates an empty Calc document.
    --draw Creates an empty Draw document.
    --impress Creates an empty Impress document.
    --base Creates a new database.
    --global Creates an empty Writer master (global) document.
    --math Creates an empty Math document (formula).
    --web Creates an empty HTML document.

    File open arguments:
    The arguments define how following filenames are treated. New treatment begins
    after the argument and ends at the next argument. The default treatment is to
    open documents for editing, and create new documents from document templates.
    -n Treats following files as templates for creation of new
    documents.
    -o Opens following files for editing, regardless whether
    they are templates or not.
    --pt {Printername} Prints following files to the printer {Printername},
    after which those files are closed. The splash screen
    does not appear. If used multiple times, only last
    {Printername} is effective for all documents of all
    --pt runs. Also, --printer-name argument of
    --print-to-file switch interferes with {Printername}.
    -p Prints following files to the default printer, after
    which those files are closed. The splash screen does
    not appear. If the file name contains spaces, then it
    must be enclosed in quotation marks.
    --view Opens following files in viewer mode (read-only).
    --show Opens and starts the following presentation documents
    of each immediately. Files are closed after the showing.
    Files other than Impress documents are opened in
    default mode , regardless of previous mode.
    --convert-to OutputFileExtension[:OutputFilterName] \
    [--outdir output_dir] [--convert-images-to]
    Batch convert files (implies --headless). If --outdir
    isn't specified, then current working directory is used
    as output_dir. If --convert-images-to is given, its
    parameter is taken as the target filter format for *all*
    images written to the output format. If --convert-to is
    used more than once, the last value of OutputFileExtension
    [:OutputFilterName] is effective. If --outdir is used more
    than once, only its last value is effective. For example:
    --convert-to pdf *.odt
    --convert-to epub *.doc
    --convert-to pdf:writer_pdf_Export --outdir /home/user *.doc
    --convert-to "html:XHTML Writer File:UTF8" \
    --convert-images-to "jpg" *.doc
    --convert-to "txt:Text (encoded):UTF8" *.doc
    --print-to-file [--printer-name printer_name] [--outdir output_dir]
    Batch print files to file. If --outdir is not specified,
    then current working directory is used as output_dir.
    If --printer-name or --outdir used multiple times, only
    last value of each is effective. Also, {Printername} of
    --pt switch interferes with --printer-name.
    --cat Dump text content of the following files to console
    (implies --headless). Cannot be used with --convert-to.
    --script-cat Dump text content of any scripts embedded in the files to console
    (implies --headless). Cannot be used with --convert-to.
    -env:<VAR>[=<VALUE>] Set a bootstrap variable. For example: to set
    a non-default user profile path:
    -env:UserInstallation=file:///tmp/test

    Ignored switches:
    -psn Ignored (MacOS X only).
    -Embedding Ignored (COM+ related; Windows only).
    --nofirststartwizard Does nothing, accepted only for backward compatibility.
    --protector {arg1} {arg2}
    Used only in unit tests and should have two arguments.


    C:\Fiddle>
    LibreOffice 6.2.5.2 1ec314fa52f458adc18c4f025c545a4e8b22c159

    Error in option: - S FDDW Checking 2013-04-16.xls

    Usage: soffice [argument...]
    argument - switches, switch parameters and document URIs (filenames).

    Using without special arguments:
    Opens the start center, if it is used without any arguments.
    {file} Tries to open the file (files) in the components
    suitable for them.
    {file} {macro:///Library.Module.MacroName}
    Opens the file and runs specified macros from
    the file.

    Getting help and information:
    --help | -h | -? Shows this help and quits.
    --helpwriter Opens built-in or online Help on Writer.
    --helpcalc Opens built-in or online Help on Calc.
    --helpdraw Opens built-in or online Help on Draw.
    --helpimpress Opens built-in or online Help on Impress.
    --helpbase Opens built-in or online Help on Base.
    --helpbasic Opens built-in or online Help on Basic scripting
    language.
    --helpmath Opens built-in or online Help on Math.
    --version Shows the version and quits.
    --nstemporarydirectory
    (MacOS X sandbox only) Returns path of the temporary
    directory for the current user and exits. Overrides
    all other arguments.

    General arguments:
    --quickstart[=no] Activates[Deactivates] the Quickstarter service.
    --nolockcheck Disables check for remote instances using one
    installation.
    --infilter={filter} Force an input filter type if possible. For example:
    --infilter="Calc Office Open XML"
    --infilter="Text (encoded):UTF8,LF,,,"
    --pidfile={file} Store soffice.bin pid to {file}.
    --display {display} Sets the DISPLAY environment variable on UNIX-like
    platforms to the value {display} (only supported by a
    start script).

    User/programmatic interface control:
    --nologo Disables the splash screen at program start.
    --minimized Starts minimized. The splash screen is not displayed.
    --nodefault Starts without displaying anything except the splash
    screen (do not display initial window).
    --invisible Starts in invisible mode. Neither the start-up logo nor
    the initial program window will be visible. Application
    can be controlled, and documents and dialogs can be
    controlled and opened via the API. Using the parameter,
    the process can only be ended using the taskmanager
    (Windows) or the kill command (UNIX-like systems). It
    cannot be used in conjunction with --quickstart.
    --headless Starts in "headless mode" which allows using the
    application without GUI. This special mode can be used
    when the application is controlled by external clients
    via the API.
    --norestore Disables restart and file recovery after a system crash.
    --safe-mode Starts in a safe mode, i.e. starts temporarily with a
    fresh user profile and helps to restore a broken
    configuration.
    --accept={connect-string} Specifies a UNO connect-string to create a UNO
    acceptor through which other programs can connect to
    access the API. Note that API access allows execution
    of arbitrary commands.
    The syntax of the {connect-string} is:
    connection-type,params;protocol-name,params
    e.g. pipe,name={some name};urp
    or socket,host=localhost,port=54321;urp
    --unaccept={connect-string} Closes an acceptor that was created with
    --accept. Use --unaccept=all to close all acceptors.
    --language={lang} Uses specified language, if language is not selected
    yet for UI. The lang is a tag of the language in IETF
    language tag.

    Developer arguments:
    --terminate_after_init
    Exit after initialization complete (no documents loaded).
    --eventtesting Exit after loading documents.

    New document creation arguments:
    The arguments create an empty document of specified kind. Only one of them may
    be used in one command line. If filenames are specified after an argument,
    then it tries to open those files in the specified component.
    --writer Creates an empty Writer document.
    --calc Creates an empty Calc document.
    --draw Creates an empty Draw document.
    --impress Creates an empty Impress document.
    --base Creates a new database.
    --global Creates an empty Writer master (global) document.
    --math Creates an empty Math document (formula).
    --web Creates an empty HTML document.

    File open arguments:
    The arguments define how following filenames are treated. New treatment begins
    after the argument and ends at the next argument. The default treatment is to
    open documents for editing, and create new documents from document templates.
    -n Treats following files as templates for creation of new
    documents.
    -o Opens following files for editing, regardless whether
    they are templates or not.
    --pt {Printername} Prints following files to the printer {Printername},
    after which those files are closed. The splash screen
    does not appear. If used multiple times, only last
    {Printername} is effective for all documents of all
    --pt runs. Also, --printer-name argument of
    --print-to-file switch interferes with {Printername}.
    -p Prints following files to the default printer, after
    which those files are closed. The splash screen does
    not appear. If the file name contains spaces, then it
    must be enclosed in quotation marks.
    --view Opens following files in viewer mode (read-only).
    --show Opens and starts the following presentation documents
    of each immediately. Files are closed after the showing.
    Files other than Impress documents are opened in
    default mode , regardless of previous mode.
    --convert-to OutputFileExtension[:OutputFilterName] \
    [--outdir output_dir] [--convert-images-to]
    Batch convert files (implies --headless). If --outdir
    isn't specified, then current working directory is used
    as output_dir. If --convert-images-to is given, its
    parameter is taken as the target filter format for *all*
    images written to the output format. If --convert-to is
    used more than once, the last value of OutputFileExtension
    [:OutputFilterName] is effective. If --outdir is used more
    than once, only its last value is effective. For example:
    --convert-to pdf *.odt
    --convert-to epub *.doc
    --convert-to pdf:writer_pdf_Export --outdir /home/user *.doc
    --convert-to "html:XHTML Writer File:UTF8" \
    --convert-images-to "jpg" *.doc
    --convert-to "txt:Text (encoded):UTF8" *.doc
    --print-to-file [--printer-name printer_name] [--outdir output_dir]
    Batch print files to file. If --outdir is not specified,
    then current working directory is used as output_dir.
    If --printer-name or --outdir used multiple times, only
    last value of each is effective. Also, {Printername} of
    --pt switch interferes with --printer-name.
    --cat Dump text content of the following files to console
    (implies --headless). Cannot be used with --convert-to.
    --script-cat Dump text content of any scripts embedded in the files to console
    (implies --headless). Cannot be used with --convert-to.
    -env:<VAR>[=<VALUE>] Set a bootstrap variable. For example: to set
    a non-default user profile path:
    -env:UserInstallation=file:///tmp/test

    Ignored switches:
    -psn Ignored (MacOS X only).
    -Embedding Ignored (COM+ related; Windows only).
    --nofirststartwizard Does nothing, accepted only for backward compatibility.
    --protector {arg1} {arg2}
    Used only in unit tests and should have two arguments.


    C:\Fiddle>
      My Computers


  8. Posts : 148
    Win 10 Pro - 1903
    Thread Starter
       #28

    RESOLUTION, I think


    Berton, bro67, sbh7600...Thank you all for your assistance.

    I tried all the above posted suggestions, but either I'm too dumb to accomplish them or my machines refuse to cooperate, so I was stymied. Then I wondered whether the old DOS commands might work.

    So I copied all the subject files into an empty directory called Fiddle...and did this:

    Safest Way to Convert Hundreds of *.xls to *.ods-dos-command-rename-xls-files-ods.jpg

    That renamed the files in Fiddle (I still have the originals in an achived folder). It worked for all *.xls AND *.xlsx files.

    I tested a few renamed files in Libre and they all worked fine, including editing and changes I made. The only difference that I found was that when I opened those files in Libre, they had no name...which didn't bother me because I wanted to save them with a new name anyway...which I did, and which worked, including re-opening them.

    I thought that posting this old-fashioned solution might be interesting for other posters who may have the same problem in the future.

    Again, I very much appreciate your attempts to assist me.
      My Computers


  9. Posts : 301
    Windows 11 - Ver: 22H2 - Build: 22621.1105
       #29

    Great to hear it worked out for you
      My Computer


  10. Posts : 11,247
    Windows / Linux : Arch Linux
       #30

    Hi folks
    glad it worked

    however you probably didn't need to do this at all if instead of using Open Office / Libre Office you use (also free) wps office ---- will use excel formats without any change whatsoever --far more compatible with Ms Office than anything else.

    Free Download WPS Office 2016/2019 for PC/Android/iOS & WPS PDF to Word, Data Recovery Master - WPS Office Download

    Not sure why this is rarely mentioned - most people seem to go for openoffice or libreoffice -- I find both of those real dogs compared to wps office.

    Cheers
    jimbo
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:02.
Find Us




Windows 10 Forums