Csv help! read from a specific cell

Reading a value from an existing cell
Do a calculation on it and enter the value in the table..
And so on..
What I'm trying to do is a fuel consumption calculator.
What I do today, every time I fuel the motorcycle, i take a picture with my cell phone of my mileage, and the amount of fuel I fueled and how much it cost.
Then when I get home I put the data into Excel and there it's easy to calculate.

In the first cell I write the date.
The new mileage value minus the previous one, that's the range I've driven.
This is the second cell.
In the third cell I write the value of the second cell (the range I traveled) divided by the amount of fuel, this is the average consumption.
In the fourth cell the quantity in liters, and in the fifth the cost.

What I've been able to do so far (on my first day in the apps)
It's just to write the data to a CSV file and display it.
But I couldn't figure out how I take them and do calculations on them to insert a new value with them.
Any chance of help? Or give me direction?
Maybe I should do it in Google Sheets and not in CSV?

Attached File

Thanks to everyone who can and is willing to help!! :slight_smile:
Delek.aia (4.6 KB)

Show what you have achieved so far with your blocks

Hello Omri Bono, welcome to the forum

Can I suggest a change of direction? Why not enter the relevant values directly into the App (into TextBoxes), at the fuel pump? The would eradicate the need for a spread sheet or CSV file.

Hi there :slight_smile:
thank you for the greetings!

you may suggest anything! :slight_smile:
"Why not enter the relevant values directly into the App (into TextBoxes), at the fuel pump?"
this is exsectly what i'm doing! (doing now with the app, until the app i was taking a photos of the data and then insert the values to the excel file)
the only issue is that i dont want to activate and reset the "trip meter" every time i'm fueling.
i want to enter the total km i did until i'm visiting the pump. (and then by reducing the last call from the km clock, i'll know how many km i did since the last time i fuled.)
(if i understand correctrly u'r suggestment, u say: "enter the 2 values of km.. the current kn and the privious one, and the app will do it with easely., the problem here is 2 things

  1. i will need to enter more data..
  2. i will need to look somewhere what was my km call at the last time i viseted the pump, so i will need to search it in the app. (the only thing i want is the app to know what was the last km reading.. and use this value.

Hope I'm understandable and not too spoiled :slight_smile:
After all, why make apps if not to save time on the little things.

do you have a suggestment about how the app will know the last km value ?
(From there it's an easy way to get what I'm looking for)

Thanks!!!! :slight_smile:

after reading your suggestment for the third time.. maybe this is the relevent answer (And if the question was why in the first place keep the fueling history, the reason is that with such monitoring, if you see a decrease/increase in the average fuel consumption, this could indicate a problem with the motorcycle, perhaps poor air pressure or a problem with the engine. That's why I prefer to follow this as well. (And even when I want to sell the motorcycle, gathering such information points to a responsible person and will give more confidence to the future buyer))

CSV is a good choice, have a look to TableView Extension Versions 3 and 4 by @Ken

that's looks like a good diraction. thanks!
coz i saw you were dealing with csv issue, do u know how can i open the csv file ?
coz i cant find the acctual file on my phone storage to edit it manualy.
can i put a button to open it ? (is there an option to do so?)


yup you need to connect your app with google sheets.
here I have some method to send data to your sheet

METRIC RAT AI2 - Post Data to a Google Sheet
METRIC RAT AI2 - Google Sheets - Simple POST and GET Data

Thanks, i will look into it.
I'm still not the most knowledgeable about scripts, I need to understand how they integrate within the application, this seems to me a long way to a more efficient solution, I'm currently trying quick and dirt_y :slight_smile:
But thanks a lot for the direction, it will definitely help me learn how to do it better. :slight_smile:

1 Like

Or use the built in Google sheets component, you will need to setup a service account on google

1 Like

The truth is that I thought that I just needed to add a few more blocks (of which I have no idea) and there I am :slight_smile:
I did not imagine that the road is still so long until the solution. :slight_smile:

No Searching required - store the values you need in TinyDb. When the App is launched, have it retrieve and display those values ready for use.

1 Like

You don't need to create or store a CSV file, just store the values in TinyDb. The values can be comma separated in TinyDb, or the App can do that after fetching them from TinyDb, if you wish to present the info in a Table.

The advantage of my proposal is that the data is always at hand, when you need it. If you start storing things in the cloud (Google Sheets) , you can only get your data if you have an internet connection.

1 Like

that's a good idea :wink:

That's a great idea it helps.

What's the best solution for exporting or sharing data if needed ?

Google Drive:

Google Sheets:

There is probably no best solution, there are many different online systems available for exporting and sharing data....

1 Like

Depends entirely on:

  1. Data type and size
  2. How many are sharing, required security etc
  3. Cost

Ok. i have made some steps.
i guess i'm on the right way,
but now i need to understand , when the screen1.initialized,
how can i get the last value from the km
and then, make some math to get the trip,
and from there 1 more math to get the km/L

any help ?

Delek_TinyDB.aia (7.1 KB)

1 Like