Im currently trying to build a flow that fetches a csv file from the below Link.
Since the file is being generated daily, the Link isn’t the same each day. To keep the manual work to a minimum, I want to get the file once a week but don’t want to put in the link manually. Is there a way to get the Link dynamically?
This is the Website:
and I marked the Link in the picture.
Thanks
Thanks for the Help.
Hello @ViolentNomad78,
There are several ways to go about this so here’s just one…
(1) HTTP Get a File to download the website you linked →
(2) Text Parser Get Elements from HTML to get all Element Type of Link (a) →
Filter where Inner content contains “Alle handelbaren” →
(3) Set Variables to set the full link to download the CSV (not necessary, but here to make it easier to read)–>
(4) HTTP Get a file to download the CSV →
(5) Set variables to trim the first two lines and the last line of the CSV (again, not necessary, but easier to read how it works) →
(5) Parse CSV to parse the trimmed text.
Here is how that looks:
Parse CSV outputs 53,000+ bundles (which I don’t even know Make will process correctly) so be VERY careful with what you place after that module. If it even works you could wipe out your entire allotment of Ops.
I’ve attached a blueprint here of a test version of this with only a few lines from the CSV.
CSV test data.json (41.4 KB)
4 Likes
Here is the blueprint for the full scenario that can get you as far as downloading the file and trimming the first two lines and the last line. This scenario doesn’t include the Parse CSV module.
download CSV.json (12.7 KB)
Again, USE CAUTION if you choose to add a Parse CSV.
3 Likes
@Donald_Mitchell thank you very much.
I actually just need 5 columns from the csv and also just data that is from 2024. Can I add a module beforw the parse csv to only get the approx 2000 rows? Not sure if this automation makes sense. For all the ops consumed I may just do it via a vba or python script tbo.
After Parse CSV, you can add an aggregator and select the 5 columns you need.
Use a CSV, Table, Text, or Array Aggregator if you need to make a new CSV, table, some other type of formatted text, or an array.
Between Parse CSV and the aggregator, use a filter to get only data from 2024.
3 Likes
@Donald_Mitchell Thank you very much. I followed your tips and got it to filter data. I want to update a certain sheet in a google sheet, since I compare this data in a different tab. If I get this correct, when I do this with add row, each bundle, in this case 1872! will create a row causing it to be 1872 ops correct? Is there a ops friendly solution? Thanks again for all the help on this.
This is the current state.
Yes, once you arrange the data correctly, you can use Google Sheets Make an API Call on this endpoint: spreadsheets/SpreadsheetID/values/SheetName:append
The structure of the body looks like this:
{ "values": [ ["Row1-Col A Value","Row1-Col B Value"], ["Row2-Col A Value","Row2-Col B Value"] ] }
This will add an entire table to the Sheet in one call, but it’s tricky to get it to work correctly.
3 Likes
Thanks. Will give it a try.
Although “tricky” isn’t very encouraging for a beginner
Hi @Donald_Mitchell. I think I gotten pretty far for my taste.
Im stuck on this here:
Maybe you can guide me in the right direction. Thanks
Sorry about that, that endpoint does require some options to be set. Here’s what I use for the query string options:
3 Likes
works just perfect. I think I need a loop or something before the API Call, since it only adds 1 value, but I think if this thing runs for 1800+ bundles, the OPs will just not be worth it. Or am I making a mistake here?
Parse CSV is an iterator since it has the potential to return multiple bundles, you’ll need to use a Text Aggregator after it.
Here’s what the Text Aggregator might look like after the CSV Parser:
Since you want 5 columns from the CSV, you’ll need 5 variables in this Text Aggregator. The For Row Separator, specify Other then input a comma as the separator.
In the body of your Google Sheets API Call, you need to wrap the result of the Text Aggregator with the values key, like this:
The result is a values object containing an array or arrays. Each nested array is a csv list of values that represents a row of data.
1 Like