OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Calc: Importing csv and running macro from Unix terminal

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
andSam
Newbie
Newbie


Joined: 21 Jul 2011
Posts: 3

PostPosted: Thu Jul 21, 2011 6:46 am    Post subject: Calc: Importing csv and running macro from Unix terminal Reply with quote

Hi,

I am attempting to write a shell script to automate a series of processes, one of which is opening and processing a .csv file using a few VBA macros in Calc.

I have used the line

Code:
oocalc "test.csv"


However when it opens the file a 'Text import' window opens requiring some user input to import the .csv.

This is an issue as the idea is to remove any user input from the process (it is intended to be run overnight). I have tried using the -headless command so the code looks like

Code:

oocalc -headless "test.csv"
oocalc "macro:///Standard.Module1.macro1"
oocalc "macro:///Standard.Module1.macro2"


Any thoughts on how to disable the menu that opens up on startup of Calc?

Thanks



Moderation probe1: moved to MACROS AND API section, where all macro related questions belong to; edited subject
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3407
Location: Manchester UK

PostPosted: Thu Jul 21, 2011 12:18 pm    Post subject: Reply with quote

Try:

http://www.oooforum.org/forum/viewtopic.phtml?t=54584

http://www.oooforum.org/forum/viewtopic.phtml?t=35604

http://www.oooforum.org/forum/viewtopic.phtml?t=68077
_________________
OpenOffice 4.0.0 and LibreOffice 4.x.x on Fedora 20, Ubuntu 13.10, Windows 8.1 Preview (Triple Boot)
Back to top
View user's profile Send private message
andSam
Newbie
Newbie


Joined: 21 Jul 2011
Posts: 3

PostPosted: Fri Jul 22, 2011 2:08 am    Post subject: Reply with quote

I have read through all of these and none seem to address the issue perfectly.
As it is part of an automated flow I need to remove all need for user input.

Ideally I would like some command line option that can force Calc to open the csv file with certain settings so the 'import settings' dialogue box doesn't appear.
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Fri Jul 22, 2011 2:20 am    Post subject: Reply with quote

Have a look at the code from my macro insertCSV2Calc


insertCSV2Calc wrote:
Inserting data from CSV file into a Calc table sheet

Documentation in ODT format (OOo2). Macros perform an automated way of importing a pre-defined structured, character delimited date file into new table. Customizable file extension, easy detection of filter options to by pass import dialogue with provided routine.

Example macro – source code needs changes!

_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
andSam
Newbie
Newbie


Joined: 21 Jul 2011
Posts: 3

PostPosted: Fri Jul 22, 2011 2:56 am    Post subject: Reply with quote

Sounds perfect

i have downloaded the file but am wondering how I can actually get at the macro (newbie I know!)
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sat Jul 23, 2011 11:05 am    Post subject: Reply with quote

[Example] Loading CSV into preformatted spreadsheets (free of stupid macros)
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group