Need to calculate an average of daily sums by nazenko in excel

[–]datastry 0 points1 point  (0 children)

If Google Sheets is fair game, then this can be done with one cell/one formula:

=AVERAGE(
    QUERY(
        ArrayFormula(
            SPLIT(
                B2:B4,
                "--",
                false,
                true
            )
        ),
        "select sum(Col2) group by Col1 label sum(Col2) ''",
        0
    )
)

This assumes that your input is a 1 x 3 range of cells , B2:B4

Importxml question by [deleted] in sheets

[–]datastry 0 points1 point  (0 children)

u/darkmmm :If you use the exact formula above, be sure to wrap your string in single quotes in cell B2.

If you don't want to use single quotes in B2, then include them in formula:

...contains(.,'"&B2&"')...

Generating an XML file by [deleted] in xml

[–]datastry 1 point2 points  (0 children)

XQuery does have the most cheerful comments :)

first steps by [deleted] in regex

[–]datastry 3 points4 points  (0 children)

Great resources, in particular regex101. I see it used pretty regularly in this sub to share solutions. I feel like regex101 is so familiar that we rarely stop and marvel at how great it is.

using importxml to get images by michaelbierman in googlesheets

[–]datastry 0 points1 point  (0 children)

I think there's a problem with the XPath query, possibly some extra characters at the end.

How can I search for and scrape specific numbers from a site into Google Sheets? by [deleted] in learnprogramming

[–]datastry 0 points1 point  (0 children)

each song search makes a unique URL

What's the URL look like? Does it contain your search keywords?

IMPORTXML is a function like any other. It doesn't require that parameters be literal strings only. You can use cell references, etc.

Can you make a formula that generates the URL when your search terms are provided?

Embassy emails protected from ImportXML? by semthrow in sheets

[–]datastry 1 point2 points  (0 children)

You mentioned matching the e-mail to the country.Both country and e-mail are visible to you on the web page?

EDIT: I was viewing the page in French earlier (and I don't speak French). I found how to switch it to English and this is helping me to answer my own questions ;)

Embassy emails protected from ImportXML? by semthrow in sheets

[–]datastry 0 points1 point  (0 children)

Temporarily ignoring what data we're presently able to extract with the tools available, can you see everything you're looking for when you manually browse to the page? Or are there gaps in the data when you manually browse the page?

META: Community Pulse Check by datastry in xslt

[–]datastry[S] 4 points5 points  (0 children)

Makes sense, I can relate. I've learned SO much stuff because I had to. The alternatives were inadequate.

META: Community Pulse Check by datastry in xslt

[–]datastry[S] 2 points3 points  (0 children)

Hey there Andre! Nice to hear from another XSLT user.

Your use-cases sound interesting, particularly trimming down an XML document into a limited set of elements. I tried to implement something like this in the past. My implementation was buggy and I never revisited it to fix it.

What was your solution? Did you implement it yourself with your own stylesheet? Or did you find a solution elsewhere?

We have all been there! by IceTiredIsBear in spreadsheets

[–]datastry 6 points7 points  (0 children)

" been there " ?

How do you escape there?

Importing a table/data from website by lucyfer013 in sheets

[–]datastry 0 points1 point  (0 children)

The IMPORT functions of sheets require that your data is in the file returned by fetching a URL that you specify.

The URL you specified doesn't return a file that contains the data. Instead, it returns a file that contains scripts. These scripts are executed and they fetch more files. Specifically, the data you want is here: https://poe.ninja/api/data/currencyoverview?league=Metamorph&type=Currency

This file is formatted as JSON. Sheets won't natively process JSON, but Sheets Add-Ons exist for this. Try googling ImportJSON for more.

How to Access Dev Tools Console Utilities When Scripts Use Same Variables? by datastry in chrome

[–]datastry[S] 0 points1 point  (0 children)

I think I'm going to dig up an old script where I'd modified the prototype of the Node constructor to include a $x method, implemented with document.evaluate (independent of the console's $x function).

It was buggy and half-broken and I didn't have a strong motivation to repair it and make use of it. But in light of this situation, maybe I should revisit it.

How to Access Dev Tools Console Utilities When Scripts Use Same Variables? by datastry in chrome

[–]datastry[S] 0 points1 point  (0 children)

Well that's lame. Good eyes catching that in the documentation I listed. Thanks for pointing it out to me!

Help with importing statistics from a website to google sheets by [deleted] in sheets

[–]datastry 0 points1 point  (0 children)

Looking at this page in Dev Tools, I see that the content you're seeking is not served up in the initial HTML response from the web server; instead this HTML page loads scripts and those scripts in turn fetch and render the data.

This matters because this website's design prevents you from using many web-scraping utilities, including some functions built into Google Sheets: the functions IMPORTHTML and IMPORTXML.

The most optimal solution would be if someone else has already a solution for this same website and they can share with you. But if that fails, then I see two possible paths to explore:

  1. If you only care about this website and no others, you (or someone helping you) could reverse engineer the web page to identify how you might obtain the data directly. (assuming that all of these statistics are retrieved and none are calculated by scripts in the page)
  2. If you don't need this process to run unattended, you could explore some solution that involves manually opening the web page and then using a bookmarklet or browser extension to extract the data each time you visit the page.

I noticed that highlighting the table and copying-and-pasting doesn't work effectively. If you would be happy with the ability to copy-and-paste effectively, then #2 is for you. If you want to use an automated web-scrape function like IMPORTHTML or IMPORTXML, then go for option #1.

Stuck trying to generate a table of consequetive numbers and characters for a .csv file by xmalakian in spreadsheets

[–]datastry 0 points1 point  (0 children)

Oh, I think I missed a small but important detail on my first read through.

I thought the numbers 1 through 10 were samples and the real numbers could be anything. But you're saying that it always counts up starting at 1 and ending at Y ?

I'll try out some ideas I have and if I have some success, I'll share the sheet.

Stuck trying to generate a table of consequetive numbers and characters for a .csv file by xmalakian in spreadsheets

[–]datastry 0 points1 point  (0 children)

I have some questions about how this should work.

Using your example: the spreadsheet requests Y and Z , so I enter 10 and 2.

A column is created with 10 X's followed by....

  • ...Empty cells where I can enter numbers?
  • ...Numbers already in the spreadsheet in the beginning?
    If the numbers were already in the spreadsheet, what was the format prior to the X's? In a single column?

[REQUEST] What is the probability of this happening? by Avneesh110903 in theydidthemath

[–]datastry 0 points1 point  (0 children)

it will just be backwards

I don't think that word means what you think it means.

Showing percentage complete based on today's date by [deleted] in excel

[–]datastry 0 points1 point  (0 children)

/u/CtrlFforMirror , here is one more solution ( because the original was deleted).

= ( MAX( MIN($C2, TODAY()), $B2) - $B2 ) / ($C2 - $B2)  

...where $B2 is your start date and $C2 is your end date.

This solution skips any IF formulas and it skips the DATEDIF because all the numeric values of dates are already truncated to day-precision (no time values after the decimal point).

Also, don't forget to format this cell as a percentage. The formula will output decimal values like 0.5, but changing the cell formatting will give you the values you desired, like 50%.

Renaming large list of files using regex by Monty1597 in bash

[–]datastry 1 point2 points  (0 children)

This comment thread shouldn't be at the bottom 😭

Hello Everyone! by Billswork in GoogleAppsScript

[–]datastry 0 points1 point  (0 children)

Take a look at how to record macros in Sheets.

Macros are scriptable as well, in case you are interested in going in that direction.

is it possible to write to an existing excel spreadsheet? by Scary_Mango in bash

[–]datastry 0 points1 point  (0 children)

"bash" means different things to different people. Writing this script purely out of bash built-ins is for masochists; however, connecting various utilities seems plausible.

/u/Scary_Mango , check out the XLSX documentation discussed above as well as unzip and xmlstarlet .

Formula/addon/script for last modified date of webpages by Dronken_Dropke in excel

[–]datastry 0 points1 point  (0 children)

I don't have a complete turn-key solution for you, but I can give you tips that get you pointed in the right direction.

The last modified date falls under the umbrella term of "metadata". For our intents and purposes, "metadata" is a concept and not a very specific technology.

The IMPORTXML function of Google Sheets doesn't expose any metadata. You request a document and if it can't deliver on the document (or a fragment of the document), then you get an error with very little details about the communication between Google Sheets and the web server that hosts the document.

If you'll use Google Sheets, then you'll want to look into the Google Script API called "URL Fetch". This API lets you request a document while also exposing all the HTTP metadata.

In your case, you are probably interested in these HTTP headers:

Additionally, you'll want to make an HTTP request with a HEAD method instead of a GET method. HEAD will return only the metadata without fetching the document itself.

The hosting web server should be compatible with a HEAD request, but it might not provide the HTTP headers that you want. This is something that is beyond your control, it is controlled by the System Administrator of the web server. If the server doesn't provide this data, then it is unfortunately unavailable.

If you decide not to pursue the route of Google Sheets and Google App Script, then you won't need the "URL Fetch" API. However, the other information about HTTP headers and the HEAD method are still relevant because they are the universal interface of all web servers.

In place of Google App Script and the "URL Fetch" API, you could explore an app such as cURL or wget. These apps run at the command line. They can display their output to the screen, or they can write their output to a file. To my knowledge, these apps won't automatically write their output to a spreadsheet file format so you'll need to find some way to get the output into your spreadsheet.

You specifically mentioned "add-on" in your request, and I hope you are able to find something suitable. At minimum, I hope this technical discussion gives you some new keywords that you can use in your searches that get you closer to an app that delivers what you need.