[Solved] Can I Write into a Closed Spreadsheet?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

[Solved] Can I Write into a Closed Spreadsheet?

Post by sokolowitzky »

I have daily/weekly raw data that should be processed with an already set spreadsheet.
All I have to do is a simple copy and paste special, since ressource file is generated with formulas.
There are around 6000 of em. So I don't want to wait the files to open and then to copy.
Can I Import their values into the processor sheet, like paste special? With help of soıme macro?
Last edited by sokolowitzky on Wed Aug 01, 2018 9:06 am, edited 1 time in total.
Win10-OpenOffice 4.1/LibreOffice 7.4
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Can I Write into a Closed Spreadsheet?

Post by Zizi64 »

Can I Write into a Closed Spreadsheet?
Absolutely not.

But you can open a document by a macro without appearing the user interface and the data.
You must write the macro because the capability of the macro recorder will not be enough for this task.
viewtopic.php?f=20&t=11096
viewtopic.php?f=44&t=41379
viewtopic.php?f=20&t=93573

You need study and use the API functions for the efective macro programming. API: Application Programming Interface. Start with Andrew Pitonyak's free macro books.
http://www.pitonyak.org/oo.php
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.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Can I Write into a Closed Spreadsheet?

Post by Villeroy »

A spreadsheet is not a database.
A spreadsheet needs to load all of its data into memorý.
Last edited by Villeroy on Wed Aug 01, 2018 8:12 am, edited 1 time in total.
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
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

Re: Can I Write into a Closed Spreadsheet?

Post by sokolowitzky »

@Tibor Kovacs, thank you sir. You've always been helpful. But unfortunately I feel hard to understand pitonyak's examples.
For example sometimes he writes how to write a macro but he does not show which variable to declare. Or he just writes Dim but he does not show if it is as object or as string.
What I'm trying to do is a very simple task. Learning how to write a macro requires a lot of time to focus. But thanks anyhow.

@Villeroy. Thanks for showing what a spreadsheet is and what is not. You've enlightened me.
Win10-OpenOffice 4.1/LibreOffice 7.4
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: [Solved] Can I Write into a Closed Spreadsheet?

Post by Zizi64 »

What I'm trying to do is a very simple task.
Really? I do not think that...
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.
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved] Can I Write into a Closed Spreadsheet?

Post by RoryOF »

You can write a macro to open each spreadsheet, insert data, and close the sheet. That process can then happen with no intervention from you.

An alternate method, which needs major redesign of the work processes, is to keep all the data in a database, and generate custom reports on demand, each replacing a former spreadsheet. In that way, each report is generated from the latest (i.e, updated) data.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] Can I Write into a Closed Spreadsheet?

Post by Villeroy »

This macro has been written. Here is my version of it: viewtopic.php?f=21&t=77069
Good luck with your database on a sheet.
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
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

Re: [Solved] Can I Write into a Closed Spreadsheet?

Post by sokolowitzky »

@Villeroy Thank you. This seems very useful.
Win10-OpenOffice 4.1/LibreOffice 7.4
Post Reply