topic continued from here:
A few practical, low-friction ways to satisfy the OP requirement of launching something that returns the system code for a given date into a plain text file. Choice depends on what is already available and how much setup is acceptable. A database query (as suggested) is fine if the data is already in a DB, but for a simple spreadsheet a script or an in-sheet formula is far lighter.
A small PowerShell script reads a CSV export of the sheet, filters for today, and writes the code to a text file. Example (adjust paths and header names as needed):
Import-Csv 'C:\path\codes.csv' |
Where-Object { ([datetime]$_.Date).Date -eq (Get-Date).Date } |
Select-Object -ExpandProperty SystemCode -First 1 |
Out-File 'C:\path\systemcode.txt' -Encoding utf8 This assumes headers named Date and SystemCode. To prompt for a date instead of using today, parse a Read-Host value. For automation, schedule this script with Windows Task Scheduler to run daily.
If staying inside Excel is preferred, a single-cell formula will return the code for today:
=IFERROR(INDEX(B:B, MATCH(TODAY(), A:A, 0)), "No code found") Here column A holds dates and B holds codes. Wrap with IFERROR to avoid #N/A when there is no match.
Troubleshooting notes: ensure consistent date formats (time portions break exact matches), trim stray whitespace in the code column, and export CSV with a stable encoding. If multiple codes exist for one date decide whether to return the first match or join them. For larger or multi-user needs, moving the data to a simple database makes scheduled queries and access control easier.
Jump to Post— dickersonka 104lol another tip, post what you need in this forum in your next post
but, lets start here, what are you having trouble with?
lol another tip, post what you need in this forum in your next post
but, lets start here, what are you having trouble with?
I have an excel spreadsheet that has two columns, a date column and a system code column. One of the applications that I use on a regular basis requires a system code, it changes each day. I want to write an app, batch file, etc., anything that upon launching will get the system code for the day(either by manually passing the value through some sort of GUI, or based off of the date on the computer) and return it to me in a text file that I can copy and paste.
Any recommendations on a language that would make this task very easy?
as you said before, you can import this into sql express with no problems correct?
you can do something like this
select SYSTEM_CODE, DATE_FIELD
where DATE_FIELD >= convert(datetime, '2008-12-1 12:00', 120)
and DATE_FIELD < convert(datetime, '2008-12-2 12:00', 120) you can run this sql select, now its a matter of what you are familiar with to get it to a text file, you can do it with dts / ssis, c#, whatever else you may prefer
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.