Can you automate Google Sheets to overwrite .txt file on change? - google-sheets

I'm running a java applet in terminal 24/7. The applet references a .txt file that requires periodic editing. That text file is a simple list of urls. The urls originate from a Google Sheet and it is sort of a clumsy process to copy a column from the Sheet, paste over the info in the .txt file, quit and restart the applet manually... Is it possible to write a script that exports data from a Google Sheet and overwrites & saves my text file? If so, how would I go about doing so?
Even better if the script could quit & restart the applet upon the .txt file being edited.
Thanks!

Related

Avoid reading the same file multiple times using Telegraf and file input plugin

I need to read csv files inside a folder. New csv files are generated every time a user submits a form. I'm using the "file" input plugin to read the data and send it to Influxdb. These steps are working fine.
The problem is that the same file is read multiple times every data collection interval. I was thinking of a solution where I could move the file that was read to a different folder, but I couldn't do that with Telegraf's "exec" output plug.
ps: I can't change the way csv files are generated.
Any ideas on how to avoid reading the same csv file multiple times?
As you discovered file input plugin is used to read entire files at each collection interval.
My suggestion is for you to instead use the directory monitor input plugin. This will read files in a directory, monitor the directory for new files, and parse the ones that have not already been picked up yet. There are some configuration settings in that plugin that make it easier to time when new files are read as well.
Another option is to use the tail input plugin which will tail a file and only read new updates to that file as things come. However, I think the directory monitor is more likely something you are after for your scenario.
Thanks!

How to allow users to Upload local file, Edit in sheets, and Write back to local file

I'm investigating if it's possible for a user to: Pick a file on disk, automatically upload it to Google Sheets, do some edits, and write the changes back to the file.
I basically want to use Google Sheets as the Editor of the local file.
Has anyone tried something like this, or can confirm if it's a feasible idea?
My rough idea:
Install a script or program, that a user (on our team) can execute with the appropriate file they pick.
Typically they right-click a file and pick "Open with MyGoogleSheetsCreate".
The ToSheets-script does the following:
Generates a temporary Spreadsheet on the user's Google Drive (or possibly a Team Drive/Folder for temp files)
Reads the custom data in the local file and enters it into the Spreadsheet.
Opens a Browser window with the generated spreadsheet.
The user makes some changes to the spreadsheet.
The user exports the changes back to the file.
User initiates this how? Some ideas:
Perferably: I build a button or menu option to "Export back to Local Disk". This would only be viable if we could explicitly say where to save this custom file, i.e. where it came from.
Optionally: They right-click the original file and pick "Open with MyGoogleSheetsRetrieve". The importer would need to know the address of the Google Sheet the local file was last exported to.
FromSheets-Script converts the Spreadsheet into our custom data format and overwrites the old file.
Bonus: The temporary Google Sheet would be automatically moved to the Bin within a couple of days (without user interaction).
I think I've got a good idea of how to convert our custom format to Sheets and vice versa. The steps I'm most unsure of are: 3.1 and 5.1

How can I send google sheets with the script

I have google sheets with a script included (the script is a simple function that I made to calculate something in the sheet). I want to send it to my colleague.
When I try to download it and send it or open it locally I get error msg "Unknow function".
How can I download it and send it to my colleague with the script included?
You have a couple of alternatives.
Solution 1
Create a new "demo" sheet, include the script, change permissions to Anyone with the link can edit (or view), send them the link and ask them to make a copy of it.
You could also send them just the link to it with copy instead of edit in the end of it (https://docs.google.com/spreadsheets/d/xxxxxxxxx/copy)
Solution 2
Copy the script to a simple text file (.txt) and send them the file. They can then copy/paste it using the Script editor on their sheet.
NOTE: Do not use any Word processor (like Office Word, Google Docs, etc) because they leave residue of entities that could render the code unusable.

How to write text into the file saved on server in swift3 iOS

I am trying to write some text to the file on Server. Text file server path is:
http://test.info.com/log.txt
So, whatever we will write on this text file can able to see in browser. Please anyone suggest me.
In one word, There is no on the fly write possible from mobile to server file.
Justification:
Question:
What's happen if I paste the logfile URL(http://test.info.com/log.txt)
into the browser?
Answer:
It will just download the log.txt file. Also, It will not allow doing
direct editing in the browser too. If it will is not feasible from the browser So how can we do it from the mobile end?
Alternatives:
Recently I worked with the same type of requirements. I have achieved it by creating the local log.txt file. Write into this file. Every day, I have uploaded the same log file into the server.
To write into the log file, I have used SwiftLog(Simple and easy logging in Swift)
You need to create 2 APIs on the server where your text file is kept. One API to get the data of the text file. Once that is done, show it in a TextView and edit it.
After editing, you can call another api to send the updated data back to the server.

trouble uploading pictures or documents through Filemaker WebDirect

In my Filemaker application, I am able to upload pictures or documents using a script that imports selected the file into a field container, and then export the contents to a shared folder on the filemaker server using a serial number and file extention as the filename and a calculation container to view as thumbnail or icon. It seems through the Filemaker Webdirect version, the export field contents script fails and was wondering if there's any acceptable alternative ways to accomplish my goal to upload files through webdirect if at all possible.
I also notice my calculation container which works brilliantly as an application but only shows as an icon in webdirect and unopenable instead.

Resources