Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"We don't care. We don't have to. We're the Phone Company."


devel / comp.unix.shell / How to format columns of an existing spreadsheet from the command line on Mac

SubjectAuthor
* How to format columns of an existing spreadsheet from the commandDr Eberhard W Lisse
`* How to format columns of an existing spreadsheet from theKaz Kylheku
 +* How to format columns of an existing spreadsheet from the commandDr Eberhard W Lisse
 |`* How to format columns of an existing spreadsheet from theKaz Kylheku
 | `- How to format columns of an existing spreadsheet from the commandDr Eberhard W Lisse
 `* How to format columns of an existing spreadsheet from the commandJohn-Paul Stewart
  `* How to format columns of an existing spreadsheet from the commandDr Eberhard W Lisse
   +* How to format columns of an existing spreadsheet from the commandDavid W. Hodgins
   |`* How to format columns of an existing spreadsheet from the commandDr Eberhard W Lisse
   | +- How to format columns of an existing spreadsheet from the commandKenny McCormack
   | `* How to format columns of an existing spreadsheet from theKaz Kylheku
   |  `- How to format columns of an existing spreadsheet from theKenny McCormack
   +* How to format columns of an existing spreadsheet from theBit Twister
   |+- How to format columns of an existing spreadsheet from the commandDr Eberhard W Lisse
   |`* How to format columns of an existing spreadsheet from the commandJanis Papanagnou
   | +- How to format columns of an existing spreadsheet from the commandJanis Papanagnou
   | `* How to format columns of an existing spreadsheet from the commandDr Eberhard W Lisse
   |  +- How to format columns of an existing spreadsheet from theLew Pitcher
   |  `* How to format columns of an existing spreadsheet from theKaz Kylheku
   |   `* How to format columns of an existing spreadsheet from theKenny McCormack
   |    `* How to format columns of an existing spreadsheet from theKaz Kylheku
   |     `- How to format columns of an existing spreadsheet from theKenny McCormack
   `- How to format columns of an existing spreadsheet from the commandDr Eberhard W Lisse

1
How to format columns of an existing spreadsheet from the command line on Mac

<kcl12iF4je6U1@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6260&group=comp.unix.shell#6260

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nospam@lisse.NA (Dr Eberhard W Lisse)
Newsgroups: comp.unix.shell
Subject: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Wed, 17 May 2023 23:59:46 +0200
Lines: 28
Message-ID: <kcl12iF4je6U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net /fjrjlULVQV/VmNplg5m6godny4h5yc/L33KrfDR/9a65xK3bS
Cancel-Lock: sha1:neeT9AexUhcyoNXdMIrPvsTkK0Q=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-US
 by: Dr Eberhard W Lisse - Wed, 17 May 2023 21:59 UTC

I need to format columns in a spreadsheet generated from CSV using
this format on the command line on a Mac:

_([$NAD] * #,##0.00_);_([$NAD] * (#,##0.00);_([$NAD] * "-"??_);_(@_)

In case you wonder, the Namibian Revenue Service requires this
format and if I can generate the spreadsheet it'll save time to
upload the data which I now have to do manually every month even
though the CSV is generated semi-automagically from the book
keeping software's backend.

Preferably XLSX because I use QSV (or rather its TO XLSX command,
but ODS will of course also work because conversion is easy and
they are working on something like TO ODS.

Language Preference in descending order: Perl, LUA, Python, Any
(working on the Mac/Homebrew).

I do not have Excel so an Apple Script would need to work on
NeoOffice.

I can write the bash function to tie this together if the script
can accept a file name as parameter, the formatting can be
hardcoded of course.

Any help would be greatly appreciated.

greetings, el

Re: How to format columns of an existing spreadsheet from the command line on Mac

<20230517151912.730@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6261&group=comp.unix.shell#6261

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Wed, 17 May 2023 22:21:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <20230517151912.730@kylheku.com>
References: <kcl12iF4je6U1@mid.individual.net>
Injection-Date: Wed, 17 May 2023 22:21:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ac155f1ecb7f71c446b39bd777aa998d";
logging-data="17175"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+SnhhUHIHnVNpXHxHuCLpp+Rzk8JxJAkQ="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:ufuBmL6xsnwgU1XOtv+4K2LXLrg=
 by: Kaz Kylheku - Wed, 17 May 2023 22:21 UTC

On 2023-05-17, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
> I need to format columns in a spreadsheet generated from CSV using
> this format on the command line on a Mac:
>
> _([$NAD] * #,##0.00_);_([$NAD] * (#,##0.00);_([$NAD] * "-"??_);_(@_)

A plain specification with input-output examples is better.
Not everyone knows what this formatting notation is.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: How to format columns of an existing spreadsheet from the command line on Mac

<kcmsh2Fde9jU1@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6262&group=comp.unix.shell#6262

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nospam@lisse.NA (Dr Eberhard W Lisse)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Thu, 18 May 2023 16:54:25 +0200
Lines: 22
Message-ID: <kcmsh2Fde9jU1@mid.individual.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net QuG0IeBtPamSafrW51EVgQoVvyVJ1AheDf54ppytmBO1mzSCOQ
Cancel-Lock: sha1:aOwOWI8x8godPCCZ7k8r4440GOY=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-US
In-Reply-To: <20230517151912.730@kylheku.com>
 by: Dr Eberhard W Lisse - Thu, 18 May 2023 14:54 UTC

Neither do I more of less.

It seems to put NAD on the left of the cell and an amount on the
right. If the amount is 0 it des not put NAD in but a '-' sign.

But, I need to figure out how to cells in an existing spreadsheet
from the command line, never mind the actual formatting (for the
time being).

el

On 18/05/2023 00:21, Kaz Kylheku wrote:
> On 2023-05-17, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
>> I need to format columns in a spreadsheet generated from CSV using
>> this format on the command line on a Mac:
>>
>> _([$NAD] * #,##0.00_);_([$NAD] * (#,##0.00);_([$NAD] * "-"??_);_(@_)
>
> A plain specification with input-output examples is better.
> Not everyone knows what this formatting notation is.
>

Re: How to format columns of an existing spreadsheet from the command line on Mac

<kcmuopFdjpjU1@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6263&group=comp.unix.shell#6263

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: jpstewart@personalprojects.net (John-Paul Stewart)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Thu, 18 May 2023 11:31:59 -0400
Lines: 28
Message-ID: <kcmuopFdjpjU1@mid.individual.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net PLiQYnHsQxYBrfxYID+18g0zgicw5ZXogdbpWtowRmAfoBf237
Cancel-Lock: sha1:KaBriqVlt4tvh9fMQ2frirXuozo=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.0
Content-Language: en-CA
In-Reply-To: <20230517151912.730@kylheku.com>
 by: John-Paul Stewart - Thu, 18 May 2023 15:31 UTC

On 5/17/23 18:21, Kaz Kylheku wrote:
> On 2023-05-17, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
>> I need to format columns in a spreadsheet generated from CSV using
>> this format on the command line on a Mac:
>>
>> _([$NAD] * #,##0.00_);_([$NAD] * (#,##0.00);_([$NAD] * "-"??_);_(@_)
>
> A plain specification with input-output examples is better.
> Not everyone knows what this formatting notation is.

That looks like the stuff spreadsheets use to specify formats for their
cells. I don't know how portable it is. It might be proprietary to
each individual spreadsheet program. There are certainly similarities
between Excel and LibreOffice Calc formatting codes, but I don't know if
they're interchangeable. And I know even less about other spreadsheets!

IOW, the example formatting string might be useless without knowing
which spreadsheet program it came from.

If the OP wants to write to a spreadsheet from the command line, there's
a Perl library specifically for writing XLSX:

https://metacpan.org/pod/Excel::Writer::XLSX
https://github.com/jmcnamara/excel-writer-xlsx

However, using that is a discussion that's probably more suited for a
Perl newsgroup rather than here in comp.unix.shell.

Re: How to format columns of an existing spreadsheet from the command line on Mac

<kcncvtFg0hmU1@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6264&group=comp.unix.shell#6264

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nospam@lisse.NA (Dr Eberhard W Lisse)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Thu, 18 May 2023 21:35:25 +0200
Lines: 11
Message-ID: <kcncvtFg0hmU1@mid.individual.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net IUBQE3dJUmulJ+5Phcm/FAJJrcBho2RG4tb8516U779nEjBbU1
Cancel-Lock: sha1:B1FaHPH5Gmh/F51fHAohrZ49g2c=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-US
In-Reply-To: <kcmuopFdjpjU1@mid.individual.net>
 by: Dr Eberhard W Lisse - Thu, 18 May 2023 19:35 UTC

No,

I want to (re-)format an existing spreadsheet. I.e. one that is
generated by a tool which can not format cells.

el
On 18/05/2023 17:31, John-Paul Stewart wrote:
[...]
> If the OP wants to write to a spreadsheet from the command line, there's
> a Perl library specifically for writing XLSX:
[...]

Re: How to format columns of an existing spreadsheet from the command line on Mac

<op.145ufirda3w0dxdave@hodgins.homeip.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6265&group=comp.unix.shell#6265

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodgins@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Thu, 18 May 2023 18:07:56 -0400
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <op.145ufirda3w0dxdave@hodgins.homeip.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="66696c95ad2b0504746a84a05a433202";
logging-data="425632"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+FxFIQSqnvM1TGh5VtKbT5K7WW17TWaxw="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:tccdCbg7WKtC8aBwJTqVv8ZapIg=
 by: David W. Hodgins - Thu, 18 May 2023 22:07 UTC

On Thu, 18 May 2023 15:35:25 -0400, Dr Eberhard W Lisse <nospam@lisse.na> wrote:

> No,
>
> I want to (re-)format an existing spreadsheet. I.e. one that is
> generated by a tool which can not format cells.

Include what program created the existing spreadsheet, what program will be
using the output, enough lines from the existing spreadsheet to demonstrate
the expected variety of input conditions, and the format lines.

Regards, Dave Hodgins

Re: How to format columns of an existing spreadsheet from the command line on Mac

<20230518185642.147@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6266&group=comp.unix.shell#6266

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Fri, 19 May 2023 01:59:24 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20230518185642.147@kylheku.com>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmsh2Fde9jU1@mid.individual.net>
Injection-Date: Fri, 19 May 2023 01:59:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a65621b08c763721a0bcae714e2f262f";
logging-data="587802"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vuxS6ct479TYIsa9UhcZ8xnAnf5bq2IQ="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:1rPC8ksORbTKkslZwZ59hUnLgDA=
 by: Kaz Kylheku - Fri, 19 May 2023 01:59 UTC

On 2023-05-18, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
> Neither do I more of less.
>
> It seems to put NAD on the left of the cell and an amount on the
> right. If the amount is 0 it des not put NAD in but a '-' sign.
>
> But, I need to figure out how to cells in an existing spreadsheet
> from the command line, never mind the actual formatting (for the
> time being).
>

I wonder if you could use the .XML file format that was used by
Excel 2003.

This is very simple, if we are to believe this Github repo:
https://gist.github.com/ilyazub/2bced708865150b275b3

Such a thing could be generated from tabulated data by simple text
processing.

An XLSX file is considerably more complicated. It's actually a ZIP
archive containing multiple files related together.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: How to format columns of an existing spreadsheet from the command line on Mac

<slrnu6dvlb.blt3.BitTwister@wb.home.arpa>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6267&group=comp.unix.shell#6267

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: BitTwister@mouse-potato.com (Bit Twister)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Thu, 18 May 2023 23:44:25 -0500
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <slrnu6dvlb.blt3.BitTwister@wb.home.arpa>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net>
Injection-Info: dont-email.me; posting-host="d4ca79ccfdddffec7c6d7e317dea9d77";
logging-data="617643"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0BMhyqgPExowUsCpxLTLMj8KT/XA4Rq0="
User-Agent: slrn/pre1.0.4-6 (Linux)
Cancel-Lock: sha1:3jI++b+M/QJIa17UnDcQREcVtAk=
 by: Bit Twister - Fri, 19 May 2023 04:44 UTC

On Thu, 18 May 2023 21:35:25 +0200, Dr Eberhard W Lisse wrote:
> No,
>
> I want to (re-)format an existing spreadsheet. I.e. one that is
> generated by a tool which can not format cells.
>

Based on those requirements, sounds easy enough to use a while loop to
read each line, use "set" command to parse each column into a variable
followed by a print or echo statement to dump the variables in the desired
order and separator.

For example the following set command will split columns at every comma.

#!/bin/bash
while read -r line; do
set -- $(IFS=',' ; echo $line)
col1=$1
col2=$2
col3=$3
echo $col3,$col1,$col2 >> new_fn_here
done < <(cat filename_for_input_here)

Suggested homework,
man set

Re: How to format columns of an existing spreadsheet from the command line on Mac

<kcomk3Fm9q3U1@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6268&group=comp.unix.shell#6268

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nospam@lisse.NA (Dr Eberhard W Lisse)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Fri, 19 May 2023 09:25:54 +0200
Lines: 22
Message-ID: <kcomk3Fm9q3U1@mid.individual.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmsh2Fde9jU1@mid.individual.net>
<20230518185642.147@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net yLSNLXzf6JoBGV0koHlhJgz9xPon5lr2U/8MO5FJa2PJweVj+0
Cancel-Lock: sha1:kLEJR1By2k+/Msmmnc8LKyDfcbc=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-US
In-Reply-To: <20230518185642.147@kylheku.com>
 by: Dr Eberhard W Lisse - Fri, 19 May 2023 07:25 UTC

It MUST be XLSX as it needs to be uploaded to the Tax Authority.

But I will look at the link.

el

On 19/05/2023 03:59, Kaz Kylheku wrote:
> On 2023-05-18, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
[...]
> I wonder if you could use the .XML file format that was used by
> Excel 2003.
>
> This is very simple, if we are to believe this Github repo:
> https://gist.github.com/ilyazub/2bced708865150b275b3
>
> Such a thing could be generated from tabulated data by simple text
> processing.
>
> An XLSX file is considerably more complicated. It's actually a ZIP
> archive containing multiple files related together.
>

Re: How to format columns of an existing spreadsheet from the command line on Mac

<kcomnqFm9q3U2@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6269&group=comp.unix.shell#6269

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nospam@lisse.NA (Dr Eberhard W Lisse)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Fri, 19 May 2023 09:27:54 +0200
Lines: 31
Message-ID: <kcomnqFm9q3U2@mid.individual.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net> <slrnu6dvlb.blt3.BitTwister@wb.home.arpa>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net mD306mv1DV7dgi1YvDwrcA832eCBBuZQLpbXOH5xornja7Wdxk
Cancel-Lock: sha1:jL6ujuqy3g8q1n+7+UyNneMh5OM=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-US
In-Reply-To: <slrnu6dvlb.blt3.BitTwister@wb.home.arpa>
 by: Dr Eberhard W Lisse - Fri, 19 May 2023 07:27 UTC

And how is that changing anything in the XLSX?

el

On 19/05/2023 06:44, Bit Twister wrote:
> On Thu, 18 May 2023 21:35:25 +0200, Dr Eberhard W Lisse wrote:
>> No,
>>
>> I want to (re-)format an existing spreadsheet. I.e. one that is
>> generated by a tool which can not format cells.
>>
>
> Based on those requirements, sounds easy enough to use a while loop to
> read each line, use "set" command to parse each column into a variable
> followed by a print or echo statement to dump the variables in the desired
> order and separator.
>
> For example the following set command will split columns at every comma.
>
> #!/bin/bash
> while read -r line; do
> set -- $(IFS=',' ; echo $line)
> col1=$1
> col2=$2
> col3=$3
> echo $col3,$col1,$col2 >> new_fn_here
> done < <(cat filename_for_input_here)
>
> Suggested homework,
> man set

Re: How to format columns of an existing spreadsheet from the command line on Mac

<kcomtbFm9q3U3@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6270&group=comp.unix.shell#6270

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nospam@lisse.NA (Dr Eberhard W Lisse)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Fri, 19 May 2023 09:30:50 +0200
Lines: 21
Message-ID: <kcomtbFm9q3U3@mid.individual.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net> <op.145ufirda3w0dxdave@hodgins.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net ICTtihvNItsYWMo5xN/1qQiqHk8uSH435Ku9NNPtoKnZz23NID
Cancel-Lock: sha1:57vmz/f+xSKkSoBcAzRPDlz8Nwk=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-US
In-Reply-To: <op.145ufirda3w0dxdave@hodgins.homeip.net>
 by: Dr Eberhard W Lisse - Fri, 19 May 2023 07:30 UTC

None of the below is going to assist in the issue of modifying a cell
format in an existing XLSX spreadsheet (never mind the format, for the
time being).

el

On 19/05/2023 00:07, David W. Hodgins wrote:
> On Thu, 18 May 2023 15:35:25 -0400, Dr Eberhard W Lisse
> <nospam@lisse.na> wrote:
>
>> No,
>>
>> I want to (re-)format an existing spreadsheet. I.e. one that is
>> generated by a tool which can not format cells.
>
> Include what program created the existing spreadsheet, what program will be
> using the output, enough lines from the existing spreadsheet to demonstrate
> the expected variety of input conditions, and the format lines.
>
> Regards, Dave Hodgins

Re: How to format columns of an existing spreadsheet from the command line on Mac

<kcon9aFm9q3U4@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6271&group=comp.unix.shell#6271

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nospam@lisse.NA (Dr Eberhard W Lisse)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Fri, 19 May 2023 09:37:13 +0200
Lines: 20
Message-ID: <kcon9aFm9q3U4@mid.individual.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net pxRmuwl/aW+E1SLdZ2WrmA4ljWYciDHK6idG7Z7ROdqPHpL6cn
Cancel-Lock: sha1:ISVz/2LpuMnMwM/H8V6jQ9UG9DM=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-US
In-Reply-To: <kcncvtFg0hmU1@mid.individual.net>
 by: Dr Eberhard W Lisse - Fri, 19 May 2023 07:37 UTC

Maybe can I try to read it with Spreadsheet::Reader::ExcelXML to
and then generate a new spreadsheet with the formatting using
something Excel::Writer::XLSX.

Sounds like a little Perl project for the weekend. I will revert.

el

On 18/05/2023 21:35, Dr Eberhard W Lisse wrote:
> No,
>
> I want to (re-)format an existing spreadsheet. I.e. one that is
> generated by a tool which can not format cells.
>
> el
> On 18/05/2023 17:31, John-Paul Stewart wrote:
> [...]
>> If the OP wants to write to a spreadsheet from the command
>> line, there's a Perl library specifically for writing XLSX:
> [...]

Re: How to format columns of an existing spreadsheet from the command line on Mac

<u47u9s$3rmct$1@news.xmission.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6272&group=comp.unix.shell#6272

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Fri, 19 May 2023 13:41:16 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <u47u9s$3rmct$1@news.xmission.com>
References: <kcl12iF4je6U1@mid.individual.net> <kcncvtFg0hmU1@mid.individual.net> <op.145ufirda3w0dxdave@hodgins.homeip.net> <kcomtbFm9q3U3@mid.individual.net>
Injection-Date: Fri, 19 May 2023 13:41:16 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="4053405"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Fri, 19 May 2023 13:41 UTC

In article <kcomtbFm9q3U3@mid.individual.net>,
Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
>None of the below is going to assist in the issue of modifying a cell
>format in an existing XLSX spreadsheet (never mind the format, for the
>time being).

The obvious question at this point is: Why did you post this question to a
shell newsgroup on Usenet?

People are entitled to give answers that are based on (i.e., "use") the
tool(s) mentioned in the newsgroup title (i.e., here the operative word is
"shell"). For example, if you ask a question in a Perl newsgroup, people
are likely to (and entitled to) give answers using Perl - even if Perl is
not really the right tool for that job (viewed in the abstract). Ditto the
previous sentence for just about any other tool/language.

Here, a shell answer is reasonable - even though shell is hardly the right
tool for your task. Somebody has already given an answer based on the
common (but usually misguided) "while read; do ...; done" shell idiom.

Moving back to your task... It seems clear to me that the obvious and
correct solution to your problem is to use Excel and some form of
automation to do the changes you need. Easiest and most straightforward
would be to use an Excel macro (and invoke it from the command line; I know
I've done this in the past - but the details escape me at the moment).\

Now, I hear you say: But one of the conditions of the problem is that I
don't have Excel. To which I say: That's like saying "I want to bake
bread, but I don't have access to flour". The only valid response to
*that* is "Get your checkbook (or credit card) and go to the grocery store
and buy some flour". Note that this analogy is not entirely facetious,
because I believe there actually are baking recipes for making stuff
without flour, but I believe the results of doing are inedible... So, it
may be possible to do this without Excel, but the results are not going to
be good.

That all said, you might find it possible to automate LibreOffice (or
similar) to do what you want (if you really can't use Excel). But in any
case, this is *not* a shell problem.

--
If you think you have any objections to anything I've said above, please
navigate to this URL:
http://www.xmission.com/~gazelle/Truth
This should clear up any misconceptions you may have.

Re: How to format columns of an existing spreadsheet from the command line on Mac

<u4807b$mn5k$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6273&group=comp.unix.shell#6273

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Fri, 19 May 2023 16:14:03 +0200
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <u4807b$mn5k$1@dont-email.me>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net> <slrnu6dvlb.blt3.BitTwister@wb.home.arpa>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 19 May 2023 14:14:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ecd9f94eff1f612fae8cfe715912992e";
logging-data="744628"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6+PYJaUjt9+yjvvZsybh9"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:p5eJ8mV8LAlBBPRrKO9AboTov9M=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <slrnu6dvlb.blt3.BitTwister@wb.home.arpa>
 by: Janis Papanagnou - Fri, 19 May 2023 14:14 UTC

On 19.05.2023 06:44, Bit Twister wrote:
> On Thu, 18 May 2023 21:35:25 +0200, Dr Eberhard W Lisse wrote:
>> No,
>>
>> I want to (re-)format an existing spreadsheet. I.e. one that is
>> generated by a tool which can not format cells.

(There were already hints about using more appropriate newsgroups.)

>
> Based on those requirements, sounds easy enough to use a while loop to
> read each line, use "set" command to parse each column into a variable
> followed by a print or echo statement to dump the variables in the desired
> order and separator.
>
> For example the following set command will split columns at every comma.
>
> #!/bin/bash
> while read -r line; do
> set -- $(IFS=',' ; echo $line)

This appears a bit convoluted; input to 'read' can also be splitted
on ',' and you can read data directly into variables; if there's a
fixed number of columns)

while IFS=, read -r col1 col2 col3
do ...

or in case of an arbitrary number of fields - and provided that you
assume bash - use an array instead of using the positional arguments

while IFS=, read -r -a col ## for Ksh use -A instead of -a
do
col0=${col[0]}
col1=${col[1]}
col2=${col[2]}
...
done

(Just to turn that non-shell thread towards a shell topic.)

And of course the simple solution would be to use an awk-onliner for
that task instead of shell.

Janis

> col1=$1
> col2=$2
> col3=$3
> echo $col3,$col1,$col2 >> new_fn_here
> done < <(cat filename_for_input_here)
>
> Suggested homework,
> man set
>

Re: How to format columns of an existing spreadsheet from the command line on Mac

<u480hb$mq5j$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6274&group=comp.unix.shell#6274

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Fri, 19 May 2023 16:19:22 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <u480hb$mq5j$1@dont-email.me>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net> <slrnu6dvlb.blt3.BitTwister@wb.home.arpa>
<u4807b$mn5k$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 19 May 2023 14:19:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ecd9f94eff1f612fae8cfe715912992e";
logging-data="747699"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184lsv52Wy9Oh22ocgVRVRk"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:iVB+CDdDIiBHEtcPxd3ZXchuL48=
In-Reply-To: <u4807b$mn5k$1@dont-email.me>
 by: Janis Papanagnou - Fri, 19 May 2023 14:19 UTC

On 19.05.2023 16:14, Janis Papanagnou wrote:
>
> And of course the simple solution would be to use an awk-onliner for
> that task instead of shell.

I meant awk /one-liner/.

For example awk 'BEGIN {FS=OFS=","} {print $3,$1,$2}'

Janis

Re: How to format columns of an existing spreadsheet from the command line on Mac

<20230519074149.723@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6275&group=comp.unix.shell#6275

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Fri, 19 May 2023 14:46:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <20230519074149.723@kylheku.com>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net>
<op.145ufirda3w0dxdave@hodgins.homeip.net>
<kcomtbFm9q3U3@mid.individual.net>
Injection-Date: Fri, 19 May 2023 14:46:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a65621b08c763721a0bcae714e2f262f";
logging-data="751456"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dEjaKwHSsVBXOxfKDs0EKwYxaBD+wANM="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:ODOXSu4mbVhB8GtcvFZ5UV6RRKw=
 by: Kaz Kylheku - Fri, 19 May 2023 14:46 UTC

On 2023-05-19, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
> None of the below is going to assist in the issue of modifying a cell
> format in an existing XLSX spreadsheet (never mind the format, for the
> time being).

I see; so your opening words:

"I need to format columns in a spreadsheet generated from CSV using
this format on the command line on a Mac:"

literally mean that you have a spreadsheet object which needs to be
manipulated, not that you have the CSV and are trying to generate
the spreadsheet with certain formatting.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: How to format columns of an existing spreadsheet from the command line on Mac

<u485c2$3rr88$1@news.xmission.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6276&group=comp.unix.shell#6276

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Fri, 19 May 2023 15:41:54 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <u485c2$3rr88$1@news.xmission.com>
References: <kcl12iF4je6U1@mid.individual.net> <op.145ufirda3w0dxdave@hodgins.homeip.net> <kcomtbFm9q3U3@mid.individual.net> <20230519074149.723@kylheku.com>
Injection-Date: Fri, 19 May 2023 15:41:54 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="4058376"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Fri, 19 May 2023 15:41 UTC

In article <20230519074149.723@kylheku.com>,
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>On 2023-05-19, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
>> None of the below is going to assist in the issue of modifying a cell
>> format in an existing XLSX spreadsheet (never mind the format, for the
>> time being).
>
>I see; so your opening words:
>
> "I need to format columns in a spreadsheet generated from CSV using
> this format on the command line on a Mac:"
>
>literally mean that you have a spreadsheet object which needs to be
>manipulated, not that you have the CSV and are trying to generate
>the spreadsheet with certain formatting.

Which, if you really think about it, is the only sensible interpretation of
those (i.e., OP's) words.

But of course, as I've noted in my previous post on this thread, people
*are* entitled to re-interpret your (meaning OP's) words, in order to
re-frame them in such a way so as to have it make sense to have been posted
in the newsgroup to which it was posted.

--
Modern Conservative: Someone who can take time out from demanding more
flag burning laws, more abortion laws, more drug laws, more obscenity
laws, and more police authority to make warrantless arrests to remind
us that we need to "get the government off our backs".

Re: How to format columns of an existing spreadsheet from the command line on Mac

<kcv9o0Fo944U1@mid.individual.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6285&group=comp.unix.shell#6285

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news-2.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nospam@lisse.NA (Dr Eberhard W Lisse)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the command
line on Mac
Date: Sun, 21 May 2023 21:29:04 +0200
Lines: 24
Message-ID: <kcv9o0Fo944U1@mid.individual.net>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net> <slrnu6dvlb.blt3.BitTwister@wb.home.arpa>
<u4807b$mn5k$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net /ysj8JqpBV/T5UhRSJV+lQ8NJNjvIK+cbcD/eIoIE9mwAqDyDg
Cancel-Lock: sha1:uhvXGM09IpN50wzN7fmAFmRBmWU=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.1
Content-Language: en-US
In-Reply-To: <u4807b$mn5k$1@dont-email.me>
 by: Dr Eberhard W Lisse - Sun, 21 May 2023 19:29 UTC

I do not have Excel. And do not want to.

I generate the XLSX from the command line (using tools like QSV),
but that's beside the point.

I need to do this on/from the command line so it can be part of a
script.

I read the (non-)answers here as I am not the only one who does
not know how to do it.

el

On 19/05/2023 16:14, Janis Papanagnou wrote:
> On 19.05.2023 06:44, Bit Twister wrote:
>> On Thu, 18 May 2023 21:35:25 +0200, Dr Eberhard W Lisse wrote:
>>> No,
>>>
>>> I want to (re-)format an existing spreadsheet. I.e. one that is
>>> generated by a tool which can not format cells.
>
> (There were already hints about using more appropriate newsgroups.)
[...]

Re: How to format columns of an existing spreadsheet from the command line on Mac

<u4dsdg$1k1o1$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6286&group=comp.unix.shell#6286

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Sun, 21 May 2023 19:45:52 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 48
Message-ID: <u4dsdg$1k1o1$1@dont-email.me>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net>
<slrnu6dvlb.blt3.BitTwister@wb.home.arpa> <u4807b$mn5k$1@dont-email.me>
<kcv9o0Fo944U1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 21 May 2023 19:45:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5012cbec04e2328c745d6ae7b4db0d5a";
logging-data="1705729"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19LOFG1APtMSwx74+0uAsBw8U2kuCqEYVw="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:cfYj3Qv1i+GTIl9+tsI8yPhXRf0=
 by: Lew Pitcher - Sun, 21 May 2023 19:45 UTC

On Sun, 21 May 2023 21:29:04 +0200, Dr Eberhard W Lisse wrote:

> I do not have Excel. And do not want to.
>
> I generate the XLSX from the command line (using tools like QSV),
> but that's beside the point.
>
> I need to do this on/from the command line so it can be part of a
> script.
>
> I read the (non-)answers here as I am not the only one who does
> not know how to do it.

You are likely correct. I doubt that many (read "any") here have
had experience generating income tax data for the Namibian Revenue
Service.

The problem here may be that we don't really have enough information
to formulate an acceptable solution for you. For myself, I'd want
to know exactly what the Namibian Revenue Service requires within the
XLSX file. Specifically, I'd need to know how XLSX applies formatting
information to each cell, and whether the Revenue Service would accept
an XLSX file in which cell contents has no formatting information, but
have been "pre-formatted". In other words, do they want the cells to
contain numbers, and formatting code, or would they accept cells with
strings that express the same information as numbers and formatting code.

/IF/ the Namibian Revenue Service accepts the latter, I'd
a) export the data in CSV form from the book-keeping software,
b) read the CSV and apply a script to transform the numeric values into
formatted strings, generating a new CSV file with formatted data, and
c) apply a CSV-to-XLSX transform (such as your QSV "TO XLSX" command)
against the formatted data CSV to create the XLSX to submit to
the revenue service.

On the surface, this all seems doable from a script.

Again, /IF/ the NRS would accept such a file, several posters here have
given you advice on how to perform step "b" (reformat cells in the CSV).

[snip]

HTH
--
Lew Pitcher
"In Skills We Trust"

Re: How to format columns of an existing spreadsheet from the command line on Mac

<20230521153007.658@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6287&group=comp.unix.shell#6287

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Sun, 21 May 2023 22:32:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <20230521153007.658@kylheku.com>
References: <kcl12iF4je6U1@mid.individual.net>
<20230517151912.730@kylheku.com> <kcmuopFdjpjU1@mid.individual.net>
<kcncvtFg0hmU1@mid.individual.net>
<slrnu6dvlb.blt3.BitTwister@wb.home.arpa> <u4807b$mn5k$1@dont-email.me>
<kcv9o0Fo944U1@mid.individual.net>
Injection-Date: Sun, 21 May 2023 22:32:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="43f5b8a9c95ec5b64b5f6cfacb63a26a";
logging-data="1904867"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+trfpMIa+s4zWcYTub9Knxnn7pr79JfWQ="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:B9PzW3Opvx7OhD5QgSAVRzPu6vM=
 by: Kaz Kylheku - Sun, 21 May 2023 22:32 UTC

On 2023-05-21, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
> I do not have Excel. And do not want to.
>
> I generate the XLSX from the command line (using tools like QSV),
> but that's beside the point.

OK, since you have the XLSX generation down, what's preventing you from
manipulating the inputs to your tools, or their behavior. to get the
required format?

Cracking open the XLSX to fix it up seems like a circuitous route.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: How to format columns of an existing spreadsheet from the command line on Mac

<u4ef6h$3v13g$1@news.xmission.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6288&group=comp.unix.shell#6288

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Mon, 22 May 2023 01:06:25 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <u4ef6h$3v13g$1@news.xmission.com>
References: <kcl12iF4je6U1@mid.individual.net> <u4807b$mn5k$1@dont-email.me> <kcv9o0Fo944U1@mid.individual.net> <20230521153007.658@kylheku.com>
Injection-Date: Mon, 22 May 2023 01:06:25 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="4162672"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Mon, 22 May 2023 01:06 UTC

In article <20230521153007.658@kylheku.com>,
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>On 2023-05-21, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
>> I do not have Excel. And do not want to.
>>
>> I generate the XLSX from the command line (using tools like QSV),
>> but that's beside the point.
>
>OK, since you have the XLSX generation down, what's preventing you from
>manipulating the inputs to your tools, or their behavior. to get the
>required format?
>
>Cracking open the XLSX to fix it up seems like a circuitous route.

But, like it or not, that *is* what OP wants to do.

And, as that great sage Woody Allen has said, the heart wants what it
wants.

--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/ForFoxViewers

Re: How to format columns of an existing spreadsheet from the command line on Mac

<20230521211719.905@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6289&group=comp.unix.shell#6289

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Mon, 22 May 2023 04:18:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20230521211719.905@kylheku.com>
References: <kcl12iF4je6U1@mid.individual.net> <u4807b$mn5k$1@dont-email.me>
<kcv9o0Fo944U1@mid.individual.net> <20230521153007.658@kylheku.com>
<u4ef6h$3v13g$1@news.xmission.com>
Injection-Date: Mon, 22 May 2023 04:18:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="43f5b8a9c95ec5b64b5f6cfacb63a26a";
logging-data="2161136"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+AHP0HES9ZHvUJn/yCfGg7E7IQIZej0tg="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:9x6Z+cW9HnlXNNgxUDgqBO9AYvU=
 by: Kaz Kylheku - Mon, 22 May 2023 04:18 UTC

On 2023-05-22, Kenny McCormack <gazelle@shell.xmission.com> wrote:
> In article <20230521153007.658@kylheku.com>,
> Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>>On 2023-05-21, Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
>>> I do not have Excel. And do not want to.
>>>
>>> I generate the XLSX from the command line (using tools like QSV),
>>> but that's beside the point.
>>
>>OK, since you have the XLSX generation down, what's preventing you from
>>manipulating the inputs to your tools, or their behavior. to get the
>>required format?
>>
>>Cracking open the XLSX to fix it up seems like a circuitous route.
>
> But, like it or not, that *is* what OP wants to do.
>
> And, as that great sage Woody Allen has said, the heart wants what it
> wants.

Wanting to crack the XLSX is half the fun. The other fun is making
a newsgroup full of fools guess about what it is one wants.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: How to format columns of an existing spreadsheet from the command line on Mac

<u4fh5j$3vila$1@news.xmission.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=6290&group=comp.unix.shell#6290

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: How to format columns of an existing spreadsheet from the
command line on Mac
Date: Mon, 22 May 2023 10:46:12 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <u4fh5j$3vila$1@news.xmission.com>
References: <kcl12iF4je6U1@mid.individual.net> <20230521153007.658@kylheku.com> <u4ef6h$3v13g$1@news.xmission.com> <20230521211719.905@kylheku.com>
Injection-Date: Mon, 22 May 2023 10:46:12 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="4180650"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Mon, 22 May 2023 10:46 UTC

In article <20230521211719.905@kylheku.com>,
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
....
>>>Cracking open the XLSX to fix it up seems like a circuitous route.
>>
>> But, like it or not, that *is* what OP wants to do.
>>
>> And, as that great sage Woody Allen has said, the heart wants what it
>> wants.
>
>Wanting to crack the XLSX is half the fun. The other fun is making
>a newsgroup full of fools guess about what it is one wants.

Indeed. Well put.

Anyway, I doubt that "cracking" the XLSX is going to be a fruitful
endeavor. The only sensible way to edit an XLSX file is to use a
spreadsheet program, e.g., Excel or LibreOffice. Trying to do it in a way
that would be on-topic here (*) (or, for that matter, just about any other
Usenet newsgroup; I don't know if there are any newsgroups dedicated to
Excel or to MS Office tools in general) is, to put it charitably, misguided.

BTW, OP has stated that he does not have Excel (where, again, trying to
solve this sort of problem w/o Excel is like trying to make bread w/o
flour), but what about LO? Can he use that?

(*) "Here" being comp.unix.shell

--
"There are two things that are important in politics.
The first is money and I can't remember what the second one is."
- Mark Hanna -

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor