Python Forum
beginner level Python:- output XLS spreadsheet instead of using tabulate
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
beginner level Python:- output XLS spreadsheet instead of using tabulate
#7
(Jan-27-2018, 07:56 PM)haziebaby Wrote: If there is a better way please comment
If the Excel file doesn't need special formatting, you can write a csv and convert to xls by running an external command from python, for example if you have libreoffice installed on your computer, the following should work:
returncode = subprocess.call("soffice --headless --convert-to xls ACI-Endpoints.csv")
if returncode:
    raise RuntimeError(('Conversion to xls failed for', 'ACI-Endpoints.csv'))
You can also convert to xlsx with soffice --headless --convert-to xlsx:"Calc MS Excel 2007 XML" file.csv
Reply


Messages In This Thread
RE: beginner level Python:- output XLS spreadsheet instead of using tabulate - by Gribouillis - Jan-27-2018, 08:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Counting of rows in Excel Spreadsheet dakrantau 2 1,988 Sep-30-2020, 02:27 AM
Last Post: dakrantau
  How do I write a line of code into an excel spreadsheet using Python code? Emerogork 2 3,194 Feb-07-2018, 06:54 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020