macmikey / 4d-google-workspace Goto Github PK
View Code? Open in Web Editor NEWmanage google docs and sheets
License: Other
manage google docs and sheets
License: Other
know the current status of the sheet, current range, etc., before loading, again
possibly use developer metadata api
probably gonna have to add a drive class
meh. i changed the way it worked, so it doesn't need to append values, any longer.
i am calling my own personal error handlers, but that won't make for a good component since i save the records in a table, and components can't have regular 4d tables.
i think the user is going to want to be able to send output to their own error handlers if they are going to submodule and throw in the components folder.
I am really beating around the bush on implementing a more general version of this
there are many different sheet requests that should probably be managed via properties being changed and then sent back
creating a sheet should be simple, right?
I found the following:
Create a spreadsheet which uses the create method - but i'm not sure if that url is helpful, because it's calling javascript.
But, it's not that simple, either - you can't create one where you want it, you have to move it
The http request
is just POST https://sheets.googleapis.com/v4/spreadsheets
, which implies that you don't even call create
especially for values for a sheet, i think we added a separate property tree.
i think what we should do, instead is add a reference to the current sheet, and leave the object intact, so the dev can modify the object directly, and the code for future development of the class is clearer and more straightforward (and it's easier to communicate with the google API)
like when trying to find the bottom of a table
useful when trying to read data
Here's doing it one way
$blankRowNumber:=$dataRow // starting to look on $dataRow
$done:=False
For each ($rowData; $values.values; $dataRow) Until ($done)
While ($rowData.length<=$commentCol)
$rowData.push("")
End while //($rowData.length<=($commentCol+1))
If ((String($rowData[$dateCol])#"") |\
(String($rowData[$psCol])#"") |\
(String($rowData[$shipCol])#"") |\
(String($rowData[$recCol])#"")) //skip comments column b/c it might be undefined.
$blankRowNumber:=$blankRowNumber+1
Else
$done:=True
End if // ((String($rowData[$dateCol])="") & (String($rowData[$psCol])="") & (String($rowData[$shipCol])="") & (String($rowData[$recCol])="") & (String($rowData[$commentCol])=""))
End for each //($rowData;$values.values) Until ($done)
Could skin the "insert at the top" cat by inserting a range and then filling it, instead of appending
https://developers.google.com/sheets/api/samples/rowcolumn
There are other things that are useful like auto-resizing rows/columns
also would have to set sheetdata if we do this
in the api description, google says that, in effect, rows will not be padded to get the right number of columns. either add code to the fetch or add separate code to get the collection to the dimension specified.
should we go both rows and columns?
make it easier to insert on top and push down
might also want to be able to just add to the top, i.e. a "reverse append" - but it isn't really a reverse append b/c we'd want to maintain the existing header rows, and insert under them.
pull a paticular event from the calendar. how we get it isn't relelvant, that's up to the calendar to either have the events preloaded or to grab it from the server.
i used K's jwt library, but since 4d's mobile lib has native jwt code, we could use that, instead.
i think the _auth was borked, but in all of the handling, it didn't get handled
Class constructor
$class:=OB Class(This)
$me:=$class.me
If ($me=Null)
$me:=OB Copy(This; ck shared; $class)
Use ($class)
$class.me:=$me
$class.new:=Formula(This.me)
End use
End if //$instance=null
if i throw a subset over the wall, all the other data in the sheet should disappear
especially if i specify the full range
$s := cs.spreadsheet.new ( $auth )
$properties := New object ( "title" ; "test spreadsheet" )
$s.spreadsheet := New object ( "properties" ; $properties )
$templateSS := cs.spreadsheet.new ( $auth ; $templateURL )
$templateSS.load ( "TEMPLATE" ; True ) // in the TEMPLATE sheet, load the grid data, which includes the cell metadata
$s.spreadsheet.sheets := $templateSS.sheetData.sheets // deep-copies the TEMPLATE sheet into the new spreadsheet
$success := $s.createSpreadsheet ()
ASSERT ($success)
// spreadsheet is at the root folder. Now, move it.
$ssID:=$s._spreadsheetId
$ssf := cs.google.driveFile.new ( $auth ; $ssID ) // the spreadsheet file
$fs := cs.google.driveFiles.new ( $auth ; "inspection logs" ; "folder" ) // find the folder with the name "inspection logs"
$numMatches := $fs.files.length
ASSERT ( $numMatches = 1 )
$folderID := $fs.getID()
ASSERT ( $folderID # Null )
$success := $ssf.moveTo ( $folderID )
ASSERT($success)
it looks like a lot of this code is going to be similar
eventDelete is an event function
probably should use a drive op to determine that, and give the dev a warning.
https://discuss.4d.com/t/component-classes/20364/6
Especially
https://discuss.4d.com/t/component-classes/20364/3?u=mikey
namespace
https://blog.4d.com/access-your-component-classes-from-your-host-project/
https://developer.4d.com/docs/en/Extensions/develop-components.html#declaring-the-component-namespace
.values
, first.getSheetnames()
works until i duplicate the sheet? set values for the sheet?
then the structure breaks and the function doesn't work b/c the props have changed.
the old code basically disabled both the range and the include grid properties. i'm wondering why.
and now i'm in full-on creating sheets mode, but there isn't an easy way to do that.
InsertDataOption and specify insertDataOption=INSERT_ROWS
.
this is especially true for things we can do via batchUpdate
and maybe spreadsheet.sheets should be a collection of sheet objects
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.