Am Thu, Mar 21, 2024 at 05:46:31PM -0400 schrieb Walter Dnes: > The province of Ontario does weekly Covid data updates which I > summarize and post on the DSLReports Canchat subforum, e.g. > https://www.dslreports.com/forum/r33854514-#google_vignette Note the > data gap in the pink and brown lines on the 3rd and 4th graphs. That's > actual missing data. In the underlying spreadsheet page those gaps > initially show up as zeros. I manually blank out region B1258:C1299 > (i.e. 2023/09/09 to 2023/10/20) every week when I update so that it > doesn't show up as zero hospitalizations. How do I set up and execute a > macro to to zap the contents of region B1258:C1299 on a page?
Why not make the alteration one step before -- in the CSV? There are CSV abstraction tools like `q`, which gives you a SQL-like interface to a csv file. Or you could write a quick transformer in python, if you know the language a bit. Pseudo code, as I haven’t worked with csv in Python in a looong time: import csv with csv.open("input file", 'r') as A: with csv.open("output file", 'w') as B: for rownum, row in enumerate(A): if rownum >= 1258 or rownum <= 1299: # write a modified row which has columns B and C blanked B.write( [row[0] + ['', ''] + row[3:] ) else: B.write(row) > Note that I have to first remove the previous week's file, because wget > won't overwrite it, and skips the download altogether. Maybe remove the -r from rm, just to peace of mind. Also, such minimalist scripts that don’t use bash features can be sh scripts instead. This increases performance, as sh loads faster than bash. ;-) -- Grüße | Greetings | Salut | Qapla’ Please do not share anything from, with or about me on any social network. It is not enough to have no opinion, you must also be unable to express it.
signature.asc
Description: PGP signature