Creating a single all day calendar event from a single google sheet - google-sheets

I want to create a single all day calendar event from a single google sheet.
I have been racking my brain over this for a couple days and its getting old. All the examples I have seen and tried to adapt use a range of cells to create multiple calendar events. I want to do something like this, every sheet is an order form, and every order will have its own sheet, so every sheet will have a single due date, and a single job name, and each sheet needs to be added to the calendar. And every time I need to make a new order I will copy the blank sheet, fill it out, and click a button to add that new order to the calendar. So every time I have thought I had it figured out, and I modify code I fond online to do this, I get errors, I try to fix them, I get others, and I just cant seem to get this stupid thing working!
I feel like what I want to do is doable, and should be pretty simple, I'm just lost on this. I am not new to coding, generally, but I have not coded is this format, and I honestly don't understand a lot of the callouts and what they are doing.
Any help? Please?
I have tried adapting code I have found across the internet, such as the code found here

Related

Solved: Extract date from my Substack webpage to Google Sheets

longtime lurker, first-time poster. I usually solve my issues & upvote without needing to post, but I've been stumped all weekend!
Edit: Erik solved it:
I was looking for an answer to extract the "datePublished" or "dateModified" from a Substack article in a Google Sheet.
Goal: This will tell me when it was the last date/time I updated, for example, my PS5 restock guide, my Walmart PS5 restock guide, etc. If it's too stale, I try to add relevant information. Having it in Google Sheets makes it streamlined as there are dozens of guides.
Test Google Sheet:
https://docs.google.com/spreadsheets/d/1hLBFMWCTc2hpC-1C8Sxd5OVREdNHTVTtrJsAAU5Jl94/edit#gid=0
I've done this before for other sites I've worked at, but there appears to be no date in the meta data on Substack :/ (I could be wrong, as I'm no expert at reading XPATH)
I do see this in the body for the linked example:
<time datetime="2022-07-29T11:52:00.000Z">Jul 29</time>
I've been trying things like this (where E17 is where I put the article URL in Google Sheets) to no effect.
=REGEXEXTRACT(IMPORTXML(E17, "//time[#datetime='datePublished']/#content"), "(.+)T")
I've been mostly working off of this StackOverflow solution, but I haven't been able to apply the same finding to Substack's formatting.
If you want to grab it directly using a Google Sheets formula, this should work for you:
=ArrayFormula(IFERROR(VLOOKUP("*",FLATTEN(IFERROR(REGEXEXTRACT(IMPORTXML("https://www.theshortcut.com/p/ps5-restock","//div[2]"),"Swider(.?.?.?.?\d\d{1}[hrago\s]*)"))),1,FALSE),"???"))
To set realistic expectations, I usually can't invest this much time into working out such a solution on this forum. But I'm on vacation at the moment and filling time while my guest is otherwise occupied.
One further note: this is specific to the two sites you gave as examples. It will only work for sites where the second <div> holds this information and only where the data exists as strings exactly like those found on these two sites (including the poster's last name as "Swider").
ADDENDUM:
Looking at this further, did you try simply the following?
=IMPORTXML(C2, "//time")
(assuming your URL is in C2, etc.)
This seems to work for me, given that it appears the date/time data you want is contained within the first <time> element on the web page.

=importhtml Google Sheets table

Unfortunately I don't know how to source this and was wondering if someone could show me how. I am trying to learn hear so the correct answer is great, but the "How to get the answer" is more important to me.
I am using google sheets, and looking to bring in a table or data point from a website. I know =importhtml works for this but I don't know how to tell it what to get, I just keep getting people giving me the answers instead of the how too.
The current one I am looking for is the website "https://www.marketbeat.com/stocks/NASDAQ/TSLA/earnings/" Using TSLA as the example stock. I am looking to bring in the table that has all the earnings dates. The header is "TESLA (NASDAQ:TSLA) EARNINGS HISTORY BY QUARTER". I am just looking for all the dates in that table, but if it is easier to bring in the whole table I'll do that instead. But I know these websites update and that can change how the =importhtml works, so I would like to be able to fix it myself.
Also I am on a Mac
Thanks for any help.
=index(IMPORTHTML("https://www.marketbeat.com/stocks/NASDAQ/TSLA/earnings/","table",2),,1)
"2" is the table index for the one you are looking for and "1" is the column that you need.
Delete 1 and you will get the whole table.
=index(IMPORTHTML("https://www.marketbeat.com/stocks/NASDAQ/TSLA/earnings/","table",2))

Why does the "continue" command appear on some google sheets but not others

I have two google sheets. In one I have created a function and want to put it into the other. In the first sheet it works great and has no issues, in the second sheet it seems to automatically insert the "continue(1,2,) etc.
The code I have, which works in the first sheet is:
=SPLIT(ADDTOTAL(SORT('REPORT LOOKUP'!F1:F35)),",")
(Addtotal is a custom script) but in the second sheet where it seems to autoinsert the "continue" it has duplicates and additional columns.
Anyone know what the issue woudl be, how I can turn off the continue if I need to?
Thanks
Sigh- much pain could have been avoided if I had checked dates the sheets were created. The difference is that the one sheet is a new google doc, the other old. The new sheets do not behave the same way as the old, they no longer use the "continue" function but just post the data.

Linking Up Google Sheets and Google Calendar

I am trying to figure out how to get work shifts that are created in a Google Sheet to be automatically entered into each individual employees Google Calendar.
Here is a link to a test Google Sheet (accessible by anyone with the link): https://docs.google.com/spreadsheets/d/1lJKwZmHaVesBA6xRxKwWEuiZVtfGfAKdK9sI39on95g/edit?usp=sharing
I assume I can enter some code into a google script, but I am not a programmer, so I have no clue where to begin - if this is even possible.
Here is a brief description of what you are seeing in the Google Sheet:
Each person has 2 weeks of shifts that run from left to right.
Each letter represents a different shift, with the corresponding day at the top.
I would need a separate email associated with Person1, Person2, etc.
I would really appreciate any help! If you have any questions at all, just ask!
Thanks,
Cory
You would need permission to access all these people's calender's. They can grant permission when the code runs. If the user has more than one calender, and you don't want the program to change/use the default calender, then you'd need to know the name of the calender that they want updated. All the information in your spreadsheet would need to be "parsed".
Basically, you need to get the data out of the spreadsheet. You will use getValues() for that. That returns a two dimensional array. So, you need to be able to use a FOR loop with a two dimensional array. The code to put a new event into a calender shouldn't be that hard relatively. Just search the documentation, and there will be example code.
Google Documentation - Event

Archiving data in google sheets - multiple rows and multiple columns

Hello everyone I am attempting to modify a script that I found in this post (Archiving in Google Spreadsheets with Date Using Apps Script). The goal is to set it up on a time trigger/button to a specific range of cells into a sheet within the same workbook. When it is archived it should overwrite the previously archived data within the range of cells on the "archive" sheet. I have played with this script with this suggested script from this post and removed the "delete" and "priorities" components of the action, but am still having problems getting it to simply overwrite what is already there. I will continue to work with it withing my limited knowledge as I continue to learn, but would greatly appreciate any help or tips. Or if their is a preexisting code that would serve the purpose that I have missed I would love to hear about it.
Thank you for any insight you can provide and for all the help in the past.
*and thanks to Jad and the User1786546 for the original posting.
I had a quick look at the script post.
If you wanted it to delete the archive data before writing to it, you might need to clear the contents of the sheet first before writing the data.
targetsheet.clearContent();
This will clear the whole target sheet, (the target sheet is a variable in the script you linked to, this name can be changed), including column headers.
If this is undesirable, then you may wish to use
getRange().clearContent();
Please see this link for more info.
https://developers.google.com/apps-script/reference/spreadsheet/range#clearContent()
If you still need further help, try sharing a dummy spreadsheet, with realistic data and sheets.

Resources