i need to know the command to open a new sheet from a file in open office using python .
can anyone help me out
Opening new sheet from file w/ python
-
- Posts: 3
- Joined: Tue Apr 14, 2020 5:22 am
Opening new sheet from file w/ python
OpenOffice 4.1.7 on Windows 10
Re: Opening new sheet from file w/ python
Do you want add a new empty Worksheet in the actual file, or you want import some data from an another file into a sheet of the actual file, or do you want create a new Spreadsheet file based on the default (or other) template?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Opening new sheet from file w/ python
LibreOffice provides a simple method importSheet(oDoc, sName, nPosition).
With OpenOffice things are more complicated. You create a new sheet and modify its properties LinkMode, LinkURL and LinkSheetName
With OpenOffice things are more complicated. You create a new sheet and modify its properties LinkMode, LinkURL and LinkSheetName
Code: Select all
Function getImportedSheet(oDoc, sURL$, sSheetName$, sNewSheet$, nPos%, nMode%, bUnlink AS Boolean)
oSheets = oDoc.getSheets()
REM any existing sheet link will be refreshed
if not oSheets.hasByName(sNewSheet) then
oSheets.insertNewByName(sNewSheet, nPos)
endif
oSheet = oSheets.getByName(sNewSheet)
oSheet.setLinkURL(sURL)
oSheet.setLinkSheetName(sSheetName)
oSheet.setLinkMode(nMode)
if bUnlink then oSheet.setLinkMode(com.sun.star.sheet.SheetLinkMode.NONE)
getImportedSheet = oSheet
End Function
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 3
- Joined: Tue Apr 14, 2020 5:22 am
Re: Opening new sheet from file w/ python
I want to create a new sheet in an existing file that contains an already existing file. Basically I need to conde see down a bunch of directories into files.Zizi64 wrote:Do you want add a new empty Worksheet in the actual file, or you want import some data from an another file into a sheet of the actual file, or do you want create a new Spreadsheet file based on the default (or other) template?
What about for libre office? Is there any more in depth documentation.Villeroy wrote:LibreOffice provides a simple method importSheet(oDoc, sName, nPosition).
With OpenOffice things are more complicated. You create a new sheet and modify its properties LinkMode, LinkURL and LinkSheetName
Code: Select all
Function getImportedSheet(oDoc, sURL$, sSheetName$, sNewSheet$, nPos%, nMode%, bUnlink AS Boolean) oSheets = oDoc.getSheets() REM any existing sheet link will be refreshed if not oSheets.hasByName(sNewSheet) then oSheets.insertNewByName(sNewSheet, nPos) endif oSheet = oSheets.getByName(sNewSheet) oSheet.setLinkURL(sURL) oSheet.setLinkSheetName(sSheetName) oSheet.setLinkMode(nMode) if bUnlink then oSheet.setLinkMode(com.sun.star.sheet.SheetLinkMode.NONE) getImportedSheet = oSheet End Function
OpenOffice 4.1.7 on Windows 10
Re: Opening new sheet from file w/ python
The LibreOffice is a fork of the OpenOffice, with a more active developer team. The LO has more features and higher compatibility with the foreign file types.What about for libre office?
https://www.libreoffice.org/
Both of these office suites are free and open source.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
- MrProgrammer
- Moderator
- Posts: 4894
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Opening new sheet from file w/ python
Hi, and welcome to the forum.
Merge sheets of spreadsheet documents
If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Why didn't you say so in the first place? XY Problemparadoxlost wrote:Basically I need to conde see down a bunch of directories into files.
Merge sheets of spreadsheet documents
If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
-
- Posts: 3
- Joined: Tue Apr 14, 2020 5:22 am
Re: Opening new sheet from file w/ python
MrProgrammer wrote:Hi, and welcome to the forum.
Why didn't you say so in the first place? XY Problemparadoxlost wrote:Basically I need to conde see down a bunch of directories into files.
Merge sheets of spreadsheet documents
If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Im not trying to merge sheets of a spreadsheet document. I'm trying to take all the different files in a directory and open them all up as different sheets in a single LO Calc file.
OpenOffice 4.1.7 on Windows 10
Re: Opening new sheet from file w/ python
Then go ahead and do so. The sheet merger code provides 90% of what you need. If the data structure of the sheets to be imported is the same, it would be more appropriate to merge all data into one list.paradoxlost wrote:Im not trying to merge sheets of a spreadsheet document. I'm trying to take all the different files in a directory and open them all up as different sheets in a single LO Calc file.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice